beforeinput event listener not added
See original GitHub issueTook me a while to find this bug.
beforeinput
is often used by rich text editors (contenteditable
), e.g Slate which I try to port to Preact. I could add the event listener manually but then I would probably need to maintain my own fork and Im not going to do that, especially considering that it’s in beta and receives breaking updates all the time.
Codesandbox
It seems that it would be a special case for Preact events logic and add few bytes because 'onbeforeinput' in el
doesn’t work. Is this something you’re willing to consider?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
HTMLElement: beforeinput event - Web APIs | MDN
Returns a DataTransfer object containing information about richtext or plaintext data being added to or removed from editable content.
Read more >Use the native beforeinput event if it's supported #11211
I'm not super familiar with React's events, but it seems like the existing onBeforeInput should really be named onTextInput , leaving open the ......
Read more >Should the HTML <select> element dispatch `beforeinput` ...
The beforeinput event isn't supposed to fire on <select> , just like it doesn't fire on non textual inputs: addEventListener('input', () => ...
Read more >Add onbeforeinput global event handler content attribute
The 'beforeinput' event fires when the value of an <input>, <textarea>, or contenteditable element is about to be modified. Add an ...
Read more >beforeinput Event vs. input Event
<p>The first input element below logs the value in the input field each time the <code>beforeinput</code> event is fired. The second one logs...
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 FreeTop 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
Top GitHub Comments
@matthewmueller I eventually discovered that some Slate logic depends on React’s synthetic events. Most basic functionality works but you’ll eventually start running into bugs if e.g using void elements.
Using the lowercase event name works in Preact
<div onbeforeinput={}>
, and I suspect the React community is going to have to make the transition to case-sensitive event names lest we end up stuck with huge mappings. I kinda hope Preact could lead that charge.