-
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
[NumberInput] no way to get value from NumberInput if not numeric #7039
Comments
@emyarod This issue is effecting the AI Applications MAS 8.3 release in January. Is there an expected resolution? |
I'm not sure what the resolution to this might be since number inputs don't seem to accept non-numeric values by default |
After further inspection I see that this is actually a bug in firefox and safari not in Carbon. There seems to be dispute in the application of the spec as far as rendering text in the UI when the value of the input is reported as an empty string. I played around a bit and I believe we can add some validation to help catch these values. @JordanWSmith15 your devs can implement as is with the current implementation. @emyarod if this seems like something that should be built into the NumberInput I would be happy to contribute this fix. Basically we just need to pass a validation function to
See a codesandbox here |
Is this something that Carbon wants to handle for their consumers? If so I would be happy to contribute a fix. |
@joshblack any problems with adding this in? Seems like it would solve an issue for @davidicus and he's willing to contribute a fix 😃 |
@davidicus hey coming back to this. Seeing how its still an issue we would be happy to accept this contribution |
What package(s) are you using?
carbon-components
carbon-components-react
Detailed description
While chrome prevents NumberInput from receiving a text values, both Firefox and Safari will allow text to be written to input. Without the feature flag flipped there is no way to receive an onChange event or handle this with an error message. This component should log all changes in the onChange handler.
NumberInput
I expect onChange handler to be called anytime the value changes on the NumberInput. Currently onChange is not called when entering in text and if you add a ref the value that is sent back is empty.
Chrome, firefox, and safari
latest
AI PAL
Steps to reproduce the issue
https://codesandbox.io/s/elegant-lewin-hxhjc?file=/src/index.js
The text was updated successfully, but these errors were encountered: