Proposition about onInput/onChange
See original GitHub issueHi 😃
In ReactDom we can find:
function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
return getInstIfValueChanged(targetInst);
}
}
Why not adding an extra condition here like:
function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
if ((!React.$$useRealOnChange && topLevelType === TOP_INPUT) || topLevelType === TOP_CHANGE) {
return getInstIfValueChanged(targetInst);
}
}
By checking React.$$useRealOnChange
in this function, a user could add this line:
React.$$useRealOnChange = true;
anywhere in their code (before or after including ReactDom) to find back the more native behavior.
I’m sorry in advance if this proposition has already been proposed
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:13 (1 by maintainers)
Top Results From Across the Web
oninput Event - W3Schools
The oninput event occurs when an element gets user input. This event occurs when the value of an <input> or <textarea> element is...
Read more >In React, what's the difference between onChange and onInput?
It seems there is no real difference. React, for some reason, attaches listeners for Component.onChange to the DOM element.oninput event.
Read more >When is onChange not the same as onChange?
A colleague raised a fair question, why doesn't an input element's onchange event type behave the same as React's onChange?
Read more >"oninput" | Can I use... Support tables for HTML5, CSS3, etc
The input event is fired when the user changes the value of an <input> element, <select> element, or <textarea> element. By contrast, the...
Read more >onchange event on input type=range is handled differently ...
Developers implement onchange rather than oninput because they test with the mouse and see it behaving the way they expect. In its current...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Bump. This problem has not been solved yet: in React’s documentation for
onChange
there is still no mention of an alternative attribute (which would have a name likeonChangeCompleted
oronChangeNative
) that uses the browser’s nativeonchange
event handler.I believe @rachelnabors was responding to the original post proposal. Yours is indeed different.
If you have a fully-formed proposal, http://github.com/reactjs/rfcs would be a good place to submit it as a PR.