-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
[Slider] Warn when min
is not less than max
#1475
Conversation
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
min
not less than max
min
is not less than max
https://codesandbox.io/p/sandbox/slider-bug-min-and-max-the-same-forked-kz8xgy It doesn't crash and logs a warning, I think this should be enough |
I can imagine a case where the min/max values are set based on some state set in other parts of the application (i.e., not hardcoded), and with certain conditions, the Slider could allow just a single value. IMO we should support such a scenario. |
All we could do differently though is not warn if min/max/value are the same? If min/max/value are all the same, it's still not possible to determine a position on the track @michaldudak |
7da0a5b
to
ee64d55
Compare
Yeah, ignore what I wrote. For some reason I thought min/max restricts the slider position within the track (that the track renders the full range, but you're not allowed to slide the thumb across the whole track). |
Fixes #1471
Log a console warning when
min
is not less thanmax
and don't update the state. When min/max are the same something divides by zero internally and causes a loop.