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

Calcite input numeric does not limit typed in numbers to min/max #4566

Closed
patrickarlt opened this issue May 17, 2022 · 5 comments
Closed

Calcite input numeric does not limit typed in numbers to min/max #4566

patrickarlt opened this issue May 17, 2022 · 5 comments
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Developer Experience Issues logged by ArcGIS Developer Experience team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. design Issues that need design consultation prior to development. p - medium Issue is non core or affecting less that 60% of people using the library ready for dev Issues ready for development implementation.

Comments

@patrickarlt
Copy link
Contributor

Actual Behavior

When using <calcite-input> as a number the user is still allowed to type in numbers outside the min/max range. While it was mentioned that this mirrors browser behavior #622 (comment).

However <calcite-input> as a number also does not allow you to type in non-numeric number which differs from default browser behavior (which allows you to type in non numeric characters).

Expected Behavior

We have had bugs introduced because we thought min and max would actually restrict users from typeing in numbers outside the min and max it seems reasonable that most people actually expect this to limit what users can type in and make it consistent with other calcite components behavior.

It seems pretty obvious from #622 and #4276 that people expect min and max to limit the value users can type into the input.

when a number outside the min/max is entered either:

  1. Set the value to the closest to the mix/max
  2. Reset the value to the previous value

Reproduction Sample

https://developers.arcgis.com/calcite-design-system/components/input/

Reproduction Steps

You can reproduce this in https://developers.arcgis.com/calcite-design-system/components/input/

  1. Set type to number
  2. Set a min and max
  3. Type something in outside the min/max range.

Reproduction Version

beta.81

Relevant Info

No response

Regression?

No response

@patrickarlt patrickarlt 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 May 17, 2022
@macandcheese
Copy link
Contributor

However as a number also does not allow you to type in non-numeric number which differs from default browser behavior (which allows you to type in non numeric characters).

This is a browser-specific behavior. We do match the native input behavior in Chrome - to allow only e. Safari handles this differently (allowing any character).

A small difference I noticed between our implementation and the native one (in Chrome), is that when e is present, our input of type number lets you type a decimal (which is briefly present and then removed), whereas the native doesn't allow the decimal to be added at all when e is present.

I do think we should generally match native behavior - which in this case would mean not resetting the invalid value to the closest min / max bound. Ostensibly the consumer could perform this validation on blur. Open to thoughts here, but I could see it being equally as confusing to provide a non-standard behavior there.

I know there is a planned update to a standalone calcite-input-number component - @jcfranco do you think this can be addressed at that time?

@geospatialem
Copy link
Member

We plan to address validation across components in the near future and have added this issue to an Epic (#4598) for tracking purposes.

@geospatialem geospatialem added this to the Freezer milestone May 19, 2022
@geospatialem geospatialem removed the needs triage Planning workflow - pending design/dev review. label May 19, 2022
@benelan benelan added the ArcGIS Developer Experience Issues logged by ArcGIS Developer Experience team members. label Jan 30, 2023
@geospatialem geospatialem added design Issues that need design consultation prior to development. ready for dev Issues ready for development implementation. labels Jul 21, 2023
@geospatialem
Copy link
Member

For dev implementation, refer to the Figma documentation:

image

@github-actions github-actions bot added the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Jul 21, 2023
@github-actions github-actions bot removed this from the Freezer milestone Jul 21, 2023
@github-actions
Copy link
Contributor

cc @geospatialem, @brittneytewks

@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Jul 26, 2023
@brittneytewks brittneytewks added the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Sep 12, 2023
@benelan benelan self-assigned this Sep 12, 2023
@benelan benelan added 1 - assigned Issues that are assigned to a sprint and a team member. 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. 1 - assigned Issues that are assigned to a sprint and a team member. labels Sep 12, 2023
@benelan benelan added the blocked This issue is blocked by another issue. label Oct 12, 2023
@benelan benelan removed this from the 2023 December Priorities milestone Oct 12, 2023
@benelan benelan added this to the Stalled milestone Oct 12, 2023
@brittneytewks brittneytewks removed the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Dec 11, 2023
@geospatialem geospatialem removed the blocked This issue is blocked by another issue. label Jan 18, 2024
@brittneytewks brittneytewks added the p - medium Issue is non core or affecting less that 60% of people using the library label Feb 8, 2024
@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 2 - in development Issues that are actively being worked on. labels Apr 30, 2024
@geospatialem
Copy link
Member

Verified in 2.8.0-next.19 with https://codepen.io/geospatialem/pen/jORoLWq when the component's min and max are set in https://codepen.io/geospatialem/pen/jORoLWq.

For instance:

<calcite-label>Quick! Enter a number between 5 and 10
    <calcite-input-number name="what" required max="10" min="5"></calcite-input-number>
</calcite-label>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Developer Experience Issues logged by ArcGIS Developer Experience team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. design Issues that need design consultation prior to development. p - medium Issue is non core or affecting less that 60% of people using the library ready for dev Issues ready for development implementation.
Projects
None yet
Development

No branches or pull requests

6 participants