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

min prop is opposite of what is expected #296

Open
Yamikaze123 opened this issue Aug 20, 2024 · 4 comments
Open

min prop is opposite of what is expected #296

Yamikaze123 opened this issue Aug 20, 2024 · 4 comments

Comments

@Yamikaze123
Copy link

I don't see much documentation on min prop in the README, so please correct me if I am understanding this wrongly, but passing value to min prop is having the opposite effect as it should. Passing a positive value is causing the thumb to move left

@ljharb
Copy link
Collaborator

ljharb commented Aug 20, 2024

I'm not sure what you're asking; min is the minimum value. It's not meant to be changed.

I do see the odd behavior when the value is already set to something below the new minimum value, and that should be fixed here by clamping the current value so it's not less than the min.

@Yamikaze123
Copy link
Author

It is a visual discrepancy. As you mentioned, min is the minimum value but passing a positive value to min is moving the slider left, meaning user can see that 0 is still a valid value, which it should not. If we move the slider right, it shows that we can only have values more than min

@ljharb
Copy link
Collaborator

ljharb commented Aug 20, 2024

It's not about that - it's that you default the values to [0], and you're responsible for ensuring that none of the values are greater than the min.

If you change the default to Math.min(0, m) where m is the min value, it'll work fine.

@Yamikaze123
Copy link
Author

That makes sense, setting the default to Math.max(0, min) does the trick

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

No branches or pull requests

2 participants