-
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
fix(Slider): check validity of number input after onChange #9132
fix(Slider): check validity of number input after onChange #9132
Conversation
❌ Deploy Preview for carbon-react-next failed. 🔨 Explore the source changes: 23fc148 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/613fa859d6117300085675a5 |
✔️ Deploy Preview for carbon-elements ready! 🔨 Explore the source changes: 23fc148 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/613fa8596b2cbb0008d2ac63 😎 Browse the preview: https://deploy-preview-9132--carbon-elements.netlify.app |
✔️ Deploy Preview for carbon-components-react ready! 🔨 Explore the source changes: 23fc148 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/613fa859246a3e000701cc76 😎 Browse the preview: https://deploy-preview-9132--carbon-components-react.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like even if an invalid="false"
prop is provided the component will be rendered as invalid no matter what, so I think we need to handle props and state sync
Screen.Recording.2021-07-07.at.10.03.32.mov
I believe this would fix the interactions with the controlled slider example as well
Screen.Recording.2021-07-07.at.10.06.43.mov
@emyarod Do you have any suggestions on how to do that? I guess, I'm thinking maybe kinda how we merge refs in ComboBox? Is that what you meant?
|
most of our class components will perform a props/state sync in |
Closes #8842
This PR updates
Slider
so that form validation happens after any changes are made. Previously, number input wouldn't allow you to backspace if the number would be invalid, even if you were changing it to something valid.Changelog
New
isValid
stateonBlur
event handler for form validationChanged
onChange
handler no longer has form validationTesting / Reviewing
Slider
story, and use the text input to type an invalid number (test both less than the min and more than the max). After clicking away, the invalid state should appear. Then update the text input to a valid number and click away. The invalid state should disappear now.