Preact: beforeinput event listener not added

Created on 8 Mar 2019  路  5Comments  路  Source: preactjs/preact

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?

bug

All 5 comments

Can confirm. The devtools show that BeforeInput is bound. Looks like we don't lowercase it, although we should. Just checked with FF and Chrome: onbeforeinput is not available as a property.

/cc @developit

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.

Fair enough 馃憤 Left a content on the PR for Upton's to move forward with :)

hey @adjourn are you able to get slate working with this addition to preact/compat?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zashy picture Zashy  路  3Comments

rajaraodv picture rajaraodv  路  3Comments

skaraman picture skaraman  路  3Comments

SabirAmeen picture SabirAmeen  路  3Comments

matthewmueller picture matthewmueller  路  3Comments