w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
144 stars 51 forks source link

`beforeinput` and `compositionupdate` event order #354

Open zcorpan opened 1 year ago

zcorpan commented 1 year ago

About [beforeinput] vs. compositionupdate, I'm surprised at the event order in Chrome. compositionupdate represents the composition string change, it does not depend on editing content from UI Events spec point of view. Therefore, I think that the builtin editor should handle compositionupdate and dispatch beforeinput and input (as its default action). Therefore, I think that compositionupdate -> beforeinput -> textInput -> input is reasonable.

Originally posted by @masayuki-nakano in https://github.com/w3c/uievents/issues/353#issuecomment-1621032371

The event order of typing ´a in an input field in Chrome is (see https://github.com/w3c/uievents/issues/353#issuecomment-1620349355):

cc @chrishtr

chrishtr commented 10 months ago

So you want the order to be this right? (highlighted move)

keydown compositionstart compositionupdate beforeinput input keyup keydown compositionupdate beforeinput textInput input compositionend keyup

garykac commented 10 months ago

Nit: I think both compositionupdates would move before their corresponding beforeinputs.

garykac commented 9 months ago

It looks like we have agreement here on the order, so I'll be updating the spec.

chrishtr commented 9 months ago

Please don't update it yet. Chromium has not confirmed if this is web compatible.

garykac commented 9 months ago

My understanding (from https://github.com/w3c/uievents/issues/353#issuecomment-1620349355) is that Firefox and Safari already ship with this event ordering.

What is the work involved in checking web compatablity? Do we have a tracking bug for this?

chrishtr commented 9 months ago

Tracked here.

zcorpan commented 7 months ago

@chrishtr the chromium fix has now reached Stable (assuming it shipped in 119). I searched for "beforeupdate" and "compositionupdate" in https://bugs.chromium.org but didn't find relevant recently filed bugs.

chrishtr commented 6 months ago

@chrishtr the chromium fix has now reached Stable (assuming it shipped in 119). I searched for "beforeupdate" and "compositionupdate" in https://bugs.chromium.org but didn't find relevant recently filed bugs.

Agreed! I double checked and couldn't find any issues either. Looks like the change was web compatible.

@garykac could you update the spec? Thanks!