question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Normalized onChange event?

See original GitHub issue

In React, the onChange event is normalized across browsers (at least as far back as IE9) so that it fires any time the content of an input changes (e.g. when the user types, backspaces, deletes, etc). Is there a similarly normalized event in preact?

Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
developitcommented, Mar 7, 2016

The backspace/delete issue is only in IE9, the remainder of issues are for making checkboxes and radio buttons magically fire onChange handlers using onClick (not a logical choice IMO, since onChange works fine for uncontrolled components and onClick works fine for controlled components), and for some oddities around <select> inputs that I have yet to observe in Preact (not sure why).

Here’s React’s onChange abstraction: https://github.com/facebook/react/blob/master/src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js

Since Preact tries to avoid browser hacks and legacy APIs whenever possible, I thinking we should move this issue into preact-compat, so we can track progress on it there. preact-compat doesn’t currently have any event normalization, but I think we’re going to need at least a rudimentary solution in order to have consistency when pulling in third party libraries.

0reactions
developitcommented, Mar 7, 2016

@chrisdavies I’m going to close this issue since there is now developit/preact-compat#20. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Normalized onChange event? #79 - preactjs/preact - GitHub
In React, the onChange event is normalized across browsers (at least as far back as IE9) so that it fires any time the...
Read more >
Normalized and Raw Event Types - TechDocs
Normalized events are events that have been processed to use the alert properties defined in the USM schema. These events become CA SOI ......
Read more >
onchange Event - W3Schools
The onchange event occurs when the value of an element has been changed. For radiobuttons and checkboxes, the onchange event occurs when the...
Read more >
React onChange Events (With Examples) - Upmostly
The onChange event in React detects when the value of an input element changes. ... One of them is the normalized event system...
Read more >
How to normalize an input (Colloquially known as how to ...
Again we have an onChange event in the input . We destructure the value from event.target.value . Then we set the last name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found