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

fix(Slider): add validation when entering number via input #8018

Merged
merged 4 commits into from
Mar 12, 2021

Conversation

tw15egan
Copy link
Collaborator

@tw15egan tw15egan commented Mar 8, 2021

Closes #7106

This prevents onChange from being fired if an invalid number is entered into the input element. The number entered is invalid if:

  • it is larger than max
  • it is lower than min
  • not a valid increment of step

Changelog

New

Changed

  • input width set to auto so that it expands based on larger max values, like NumberInput
  • Updated tests to check if that state is only updated for valid numbers

Removed

  • Old storybook remnants
  • DocToc comment in Modal.mdx

Testing / Reviewing

In the Slider story, try entering a value outside of the min and max. Default is 0 and 100. It should not update to invalid values. Also, try entering 1.5 to validate the step of 1

@netlify
Copy link

netlify bot commented Mar 11, 2021

Deploy preview for carbon-elements ready!

Built with commit fb72ef7

https://deploy-preview-8018--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Mar 12, 2021

Deploy preview for carbon-components-react ready!

Built without sensitive environment variables with commit fb72ef7

https://deploy-preview-8018--carbon-components-react.netlify.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[slider]: Can use text input to enter value outside slider range
3 participants