-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
onChange
event doesn't trigger when direclty clicking on the maximum input[type=range]
value
#12926
Comments
onChange
event doesn't trigger when direclty clicking on the maximum input[type=range]
value
The workaround of using Without React, there is no issue with the |
@brainlulz I found one interesting thing, the range work after I remove your max attribute, see https://codesandbox.io/s/318jw3jjkq It may be related to how react set the attributes when rendering the dom |
It looks like this only happens when @whs-dot-hk That's why by removing the |
The value of range is not a integer as everyone expected, it is a string https://codesandbox.io/s/ykkon3qp5j (Edited) same here |
It doesn't change anything to the issue described here. https://codesandbox.io/s/r883k20pn When you use html native properties it is string anyway <input type="range" max="10" /> |
Compare https://codesandbox.io/s/81m5w3q4ql with https://codesandbox.io/s/llx9714o7m both of them fire the event input when click on the max value, the max=60 one fire input then change event, but max=10 |
Is changing the code binding the default of onInput to onChange possible here? Is there any drawbacks? |
This sounds like something that should be easy to fix. Anyone wants to look into why this is happening? |
@gaearon I'm currently working on it |
Sorry, I should have explained what's happening here when I marked it as a bug. The reason this is happening is because https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range
When we track the input's value we read that
When we track the input's value we define a getter/setter for the A couple solutions would be:
The first option is likely the easiest solution. I'm not sure what effects updating |
@Illu I have a fix locally I can submit, but if you want to give it a try feel free to and I'll defer to you 🙂 |
@aweary thanks man ! I'll give it a try 😃 |
@aweary May I present you some test case I have wrote mine, but this is already there It said the order
Some test case I wrote It's the value always correct? Or is it 50? |
Fixed in React 16.4.1. |
oninput working perfect instant of onchange |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When you directly after the loading choose the maximum value on the input type range, the event isn't fire with an onChange. The event is fire when it's not the maximum value of the input.
Sandbox: https://codesandbox.io/s/7kv59yj360
Click on the maximum (right) of the input of type range.
There is no message on the console and the displayed value doesn't change as expected
Click on a other value on the input, a message is displayed in the console and the value change
When you click on the last value it's now displayed.
What is the expected behavior?
An event should trigger when you directly click on the maximum value of the input of type range.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Testing on macOS High Sierra, Firefox 60.0.1, Safari 11.1, Chrome 66.0.3359.181, react 16.2.0
To get around this behaviour, I had to change onChange by onInput but add a blanck onChange to still get the drag behaviour on Safari on Iphone (see this CodeSandBox )
The text was updated successfully, but these errors were encountered: