w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
145 stars 52 forks source link

Event order between "keypress" and "beforeinput" #220

Open masayuki-nakano opened 5 years ago

masayuki-nakano commented 5 years ago

Ccing @garykac

Currently, UI Events defines event order of "keypress" event is:

  1. keydown
  2. beforeinput
  3. keypress
  4. input
  5. keyup

However, both Chrome and Safari uses this event order:

  1. keydown
  2. keypress
  3. beforeinput
  4. input
  5. keyup

Even for Firefox, the latter event order makes sense too because Firefox implements each user operation in editor is a default action of keypress event. So, if Firefox needs to conform to current draft's event order, Mozilla need to rewrite event handling a lot.

So, both backward compatibility with Chrome/Safari and for implementing beforeinput quicker on Firefox, I'd like to suggest that the event order should be changed in the UI Events.

garykac commented 4 years ago

I used the order proposed here in my draft Key event handling algorithm doc:

https://docs.google.com/document/d/1LJQvjEmWZGzVgZnofpvdkxMj1hEnLniD72XD4DLJWx4/edit?usp=sharing

This doc is still an early draft, but please feel free to review and comment