-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Slider: Fixed max value miscalculation #1664
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
Conversation
DatePicker test failure is independent of my fix. |
Please implement the logic from spinner. Arbitrary precision fixing isn't very elegant. |
There is a behavioral difference between the spinner and the slider, if an invalid default value(not divisible by step) is set:-
Hence I added the offset(instead of the spinner logic), to preserve this flooring behavior which was enforced by one of the previous test cases. |
I'm not sure what you mean by "invalid default value" since spinner's don't have default values. Are you referring to the scenario where at the time of initialization, the associated text field has a value which results in a step mismatch? In that case, absolutely nothing is done to the value. I can't really respond to the other part since it's based on the first part, which I don't understand. Perhaps you can clarify with a jsbin? |
Due to floating point precision while dividing floats followed by Math.floor(). Fixes #12852
Implemented the logic from the spinner in the latest commit. It will now round-off the max value. |
Is this being merged? |
This new logic still has a problem with the range Perhaps instead of subtracting a step from max, we could build in the knowledge that the last step may not be a full step and keep the user-set maximum (since that's what the user intended, since it was explicitly set). |
Due to floating point precision while dividing floats followed by Math.floor().
Fixes #12852