Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number input converts space value to zero #10606

Open
2 of 6 tasks
nwhittaker opened this issue Oct 24, 2024 · 0 comments
Open
2 of 6 tasks

Number input converts space value to zero #10606

nwhittaker opened this issue Oct 24, 2024 · 0 comments
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

Comments

@nwhittaker
Copy link
Contributor

nwhittaker commented Oct 24, 2024

Check existing issues

Actual Behavior

The <calcite-input-number> element shows a value of 0 when its value prop is programmatically set to any number of space characters.

Screenshot 2024-10-24 at 11 02 04 AM

Expected Behavior

The element ignores space values -- treating them like any other non-numeric character.

Screenshot 2024-10-24 at 11 05 14 AM

Reproduction Sample

  1. Sample 1: https://codepen.io/mac_and_cheese/pen/JjgxNyr
  • Open the sample
  • Select the Set value to " " button
  • Observe the first component's value change
  1. Sample 2 (doc site) https://developers.arcgis.com/calcite-design-system/components/input-number/#sample

Reproduction Steps

  1. Visit the input-number doc sample
  2. Open the Properties panel, if needed
  3. Enter spaces into the value field and observe the input element's displayed value
  4. Compare with entering non-numeric characters into the value field

Reproduction Version

2.13.0

Relevant Info

Consider using Number.parseFloat() and/or Number.parserInt() for doing the number conversion. Number() converts empty/blank strings to 0, but the parse functions converts them to NaN.

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 as 0 or cleared out/emptied.

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Field Apps

@nwhittaker nwhittaker added 0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. needs triage Planning workflow - pending design/dev review. labels Oct 24, 2024
@github-actions github-actions bot added ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone labels Oct 24, 2024
@geospatialem geospatialem added p - low Issue is non core or affecting less that 10% of people using the library estimate - 2 Small fix or update, may require updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. refactor Issues tied to code that needs to be significantly reworked. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. and removed needs triage Planning workflow - pending design/dev review. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. refactor Issues tied to code that needs to be significantly reworked. labels Nov 12, 2024
@DitwanP DitwanP added this to the 2025-06-24 - Jun Milestone milestone Jan 3, 2025
@DitwanP DitwanP removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants