-
Notifications
You must be signed in to change notification settings - Fork 4
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 - Submitted Form Value is not correct #228
Comments
Finally got to this issue, thanks for reporting. I will try to fix it internally meanwhile by detecting the precision passed in the step and handling the step calculations in a different way |
Thanks for looking into this and providing alternative, I agree with you on the javascript and its quirks with float. Though I'd prefer using using ints, I'd also expect it to behave somewhat similar to the native input range element so in this case, i'd expect 30.00 to be 30 |
Writing tests and releasing a patch early this week :) Area.mp4 |
You can try it out in 2.10.8 🚀 |
Thank you @blvdmitry, confirmed is working as expected in 2.10.8 🔥 |
Describe the bug
Upon form submit, the form action's value of the Slider is not correct.
To Reproduce
step={.01}
inside<form action={onAction}>
elementformAction
value returned from the form's action is not correct. The value does the match the Slider's value.CodeSandBox
https://codesandbox.io/p/devbox/reshaped-slider-decimal-vwtxvc?file=%2Fapp%2Fpage.tsx%3A11%2C26
Expected behavior
Expect the value of Slider to match the sliders value (does not work for uncontrolled as well).
On submit of native HTML slider it shows the decimal values
Proposed solution
I believe the fix is to pass the
step
attribute to the nativeinput
element. Currently the value is correct in the DOM element but is missing the step attribute so the browser is rounding to the defaultstep
.https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#step
Environment (please complete the following information):
Additional Context:
In addition, when
step={0.01}
and User is dragging the slider, value can sometimes show a long numberThe text was updated successfully, but these errors were encountered: