w3c / input-events

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

Partial committing composition definition is more complicated than actual implementations #87

Open masayuki-nakano opened 6 years ago

masayuki-nakano commented 6 years ago

6. . Event order during IME composition defines partial committing composition case at 6 and the following NOTE.

  1. If only a part of the composition string was committed to the DOM, while another part is not yet to be committed, the process starts over from step 3 with the non-committed part of the final composition string as the new initial composition string.

NOTE Note that while every composition only has one compositionstart event, it may have several compositionend events.

However, as far as I've tested, Firefox, Chrome and Safari does not handle partial commit as such. All of them commits (long) composition with only partial committed string. Then, restart composition with compositionstart event and compositionupdate event with remaining composing string.

I believe that current browser implementation makes more sense because web apps do not need to support partial commit by themselves and web apps can now composing range only with retrieving selected range at compositionstart.

So, there is no problem with defining compositionend and compositionstart are always pair.

I tested with "live conversion mode" of Apple Japanese Input and ATOK on macOS (but IIRC, on Windows, same result).

(And I guess that IME vendors need to implement as so for compatibility with all existing IME-aware native applications. Windows API has partially committed composition string representation with treating committed part as "fixed" clauses. However, I've never meet such IME even though I work on maintaining IME handler of Gecko for more a decade.)

johanneswilm commented 6 years ago

However, as far as I've tested, Firefox, Chrome and Safari does not handle partial commit as such. All of them commits (long) composition with only partial committed string. Then, restart composition with compositionstart event and compositionupdate event with remaining composing string.

Isn't that the same thing point 6 says?

masayuki-nakano commented 6 years ago

No, I meant that should restart from point 2, i.e., with compositionstart.

johanneswilm commented 6 years ago

Ah I see. This was actually the case at one stage - one compositionstart could have several compositionend events. Isn't this issue a duplicate of https://github.com/w3c/uievents/issues/202 ?

masayuki-nakano commented 6 years ago

No, it's issue about event order between input and compositionend. Well, on the other hand, the issue is important for #49. I suggested to insert compositionend into a pair of beforeinput and input...

johanneswilm commented 6 years ago

Ok, but it's closely related. The thing about multiple compositionend events is discussed starting here: https://github.com/w3c/uievents/issues/202#issuecomment-407601959 .