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.

beforeinput event listener not added

See original GitHub issue

Took 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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
adjourncommented, Mar 15, 2019

@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.

1reaction
developitcommented, Mar 9, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

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