-
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
Add event that behaves similar to the native change
event
#4126
Comments
We've suggested in the past binding to onBlur if that's the semantics you want. Does that work for you? |
onBlur fires on every blur even if nothing has changed. Why should developers have to fake an event behaviour when a native standard event has that exact behaviour? |
I am in this situation too very often. Very good example is Range input. I understand React's way of handling input/change events simplifies things. With only What's the reason behind this decision? Is it even possible to move closer to standard behaviour at this stage? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
Because React has repurposed
onChange
to behave likeonInput
there is no way to get actualchange
event behaviour without binding a non-delegated native event in lifecycle events.change
event behaviour is sometimes important to have.input
-like behaviour does make sense for what React usesonChange
for (live updating of state associated withvalue=""
and anything derived from it). But other use cases, like triggering an ajax post once a user has finished with an input, require the standard behaviour ofchange
for text inputs where it is only fired after a user is finished with the input.These use cases are reasonable to support within React. If
onChange
is going to be changed to behave in a non-standard way. Then we should add another custom non-standard event name that lets React elements bind to behaviour that is closer to howchange
behaves (with React's event delegation handling).Event name ideas:
The idea of using "commit" in the name comes from the HTML spec.
~ Section 4.10.5.5 Common event behaviours
The text was updated successfully, but these errors were encountered: