Number input converts space value to zero #10606
Labels
0 - new
New issues that need assignment.
ArcGIS Field Apps
Issues logged by ArcGIS Field Apps team members.
bug
Bug reports for broken functionality. Issues should include a reproduction of the bug.
calcite-components
Issues specific to the @esri/calcite-components package.
estimate - 2
Small fix or update, may require updates to tests.
impact - p2 - want for an upcoming milestone
User set priority impact status of p2 - want for an upcoming milestone
p - low
Issue is non core or affecting less that 10% of people using the library
Milestone
Check existing issues
Actual Behavior
The
<calcite-input-number>
element shows a value of0
when itsvalue
prop is programmatically set to any number of space characters.Expected Behavior
The element ignores space values -- treating them like any other non-numeric character.
Reproduction Sample
Set value to " "
buttonReproduction Steps
Reproduction Version
2.13.0
Relevant Info
Consider using
Number.parseFloat()
and/orNumber.parserInt()
for doing the number conversion.Number()
converts empty/blank strings to0
, but the parse functions converts them toNaN
.Regression?
No response
Priority impact
impact - p2 - want for an upcoming milestone
Impact
Impact is when using
<calcite-input-number>
to edit untrusted data. Since the input coerces alpha characters differently then space characters, this adds an extra layer of transformation the consumer has to do to the value before handing it off to the input. Otherwise, there's ambiguity in the submission handler as to whether the coerced value should be set back in the data as0
or cleared out/emptied.Calcite package
Esri team
ArcGIS Field Apps
The text was updated successfully, but these errors were encountered: