-
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]: Slider conflicted validation when non-numerical is entered #11177
Comments
Duplicate of #9225 |
Duplicate of #9696 |
@nelsonchen90 This is closely related to #7039 in that it's a similar issue (but with NumberInput instead of Slider) ultimately caused by a bug in Firefox. In the case of NumberInput, Otherwise my understanding is that this is blocked externally by the browser's implementation. |
@tay1orjones thanks for the analysis.
Are you proposing a new prop |
@tay1orjones |
@tay1orjones sorry for mentioning you again, but could this fix be back-ported to v10? |
Package
carbon-components, carbon-components-react
Browser
Firefox
Package version
10.56.0
React version
17.0.2
Description
When the
props.invalid
is provided to the component, it seems to be overriding the internal validation by Slider.In Chrome, this seems to be fine, since it prevents user from entering non-numerics to the text input. However, when in Firefox, it's still allowed to enter alphabetical characters. The internal validation logic will catch this error - in the storybook, it will highlight with red border on the input box.
But when we provide external validation, it fails to validate, because
props.onChange
is not called when the input value is not valid (alphabetics), thus it never reaches to external validation logic. Neither user nor application have a way to capture such error.CodeSandbox example
https://codesandbox.io/s/slider-bugs-forked-6vtp9c?file=/src/index.js:307-313
Steps to reproduce
Code of Conduct
The text was updated successfully, but these errors were encountered: