-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Bug]: allowEmpty behaviour in NumberInput is not able to distinguish empty string with characters other than numbers #13624
Comments
@nikhil-issac would you be able to insert a screen recording reproducing the issue? I can't seem to do it from the reproduction steps. |
@francinelucca Sorry for the late response!!! |
thanks! @nikhil-isaac, I see the issue now. Could you drop that code you're using in the screenrecord into a sandbox? 🙏🏻, looks different than the one in the reproduction steps |
Sure @francinelucca I updated the same sandbox https://codesandbox.io/s/carbon-number-input-allow-empty-invalid-issue-97mho?file=/src/index.js. |
Was able to reproduce in firefox, reopening |
Hi Team, any solutions we got for this issue? |
Browsers disagree on how to handle non-numeric input, see this bugzilla thread for more info. Additionally, carbon/packages/react/src/components/NumberInput/NumberInput.tsx Lines 300 to 302 in c678397
This is why I hope this helps, and sorry for the lack of information earlier. I'm going to close this as a duplicate but happy to continue the conversation or pursue other options if you have ideas for a different fix or solution to the problem. |
Duplicate of #7039 |
Package
carbon-components-react
Browser
Chrome, Safari, Firefox
Package version
v7.59.6
React version
v17.0.2
Description
When I set
allowEmpty
to true forNumberInput
, then whenever I type any characters other than numbers(like a, b, c, etc), I get onlyempty string
("") inonChange
prop. I would like to distinguish between typing an actual empty string(valid value for our usecase) and typing any characters other than numbers(invalid value for our usecase).Reproduction/example
https://codesandbox.io/s/carbon-number-input-allow-empty-invalid-issue-97mho?file=/src/index.js
Steps to reproduce
Suggested Severity
Severity 2 = User cannot complete task, and/or no workaround within the user experience of a given component.
Application/PAL
Cloud & Cognitive Software
Code of Conduct
The text was updated successfully, but these errors were encountered: