w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

Firing beforeInput events when inputType are deleteByCut and deleteContentBackward when a node doesn't have any content #75

Open gked opened 6 years ago

gked commented 6 years ago

Hi, I have came across the issue where deleteByCut and deleteContentBackward input types are not firing consistently in Chrome and Safari in cases when target node is empty (in the sense that there is no text to be removed). There maybe other events as well.

Currently, Chrome deleteByCut - event is not firing deleteContentBackward - event is firing

Safari deleteByCut - event is not firing deleteContentBackward - event is not firing

Should we generalize this somehow? Should we always fire beforeInput events, regardless of whether there is content to be affected or not?

johanneswilm commented 6 years ago

@gked I think the events should fire under all circumstances. Whether or not there actually is something to cut must be up to the JavaScript app to determine. The JavaScript app may for example have defined it's own selection system for table cells/rows/columns. So while the browser's text selection could be empty, the app may by the means of styling of table cells have selected specific table cells and then delete those in case of user interaction indicating deletion.

The alternative will just be even more tricks in the JavaScript, where one constantly needs to make sure that the selection is not empty in case of presenting a different selection mechanism.

parandoodudge commented 1 year ago

I was trying to make an html editor and found out this issue, which.. consumed so much time of mine. I think the event should be triggered whatever input type'd be fired up from the input, as it's name, 'before-input'.