Re: [UIEvents] Keydown/keyup events during composition

> On Jan 11, 2016, at 8:26 PM, Masayuki Nakano <masayuki@d-toybox.com> wrote:
> 
> As far as I know, Gecko doesn't dispatch keydown nor keyup event for IME unaware applications because JS changes something at keydown or keyup event handler causes forcibly committing composition that may have caused IME unavailable on such web pages.

I see. So not dispatching keydown/keyup during a composition was a mitigation strategy for this problem?

> However, there is an important thing is, which key value is proper value for keyboard events during composition. For example, in Kana input mode of Japanese IME, ASCII characters vs. Kana characters. Due to the platform limitations, browsers cannot retrieve what character *will* be inputted into the composition string.

Yeah, I don't think we'll be dispatching the final (composed) character's key code.

> At a meeting of UI Events (or D3E Events), we discussed this issue. IIRC, at that time, we didn't find any proper value but browsers should *not* dispatch keyboard events during composition (but allowing it for backward compatibility for non-Gecko browsers, therefore, currently defined with MAY).

I don't think having such a big difference in IME behavior is desirable.  We should somehow find a way to interoperate in this regard.

Given the compatibility risk of not firing key up/down in all non-Gecko browsers is quite high, firing it in Gecko seemed like the best way forward.  Having said that, I do see your rationale for not firing key up/down during composition.

> I believe that web authors shouldn't handle keyboard events for text input. I.e., shouldn't need keyboard events during composition because such applications cannot support handwriting system and/or speech input system. At least spec should recommend web authors should handle "compositionupdate", "beforeinput" and/or "input". Handling keydown/keyup event during composition means that a keydown/keyup event causes double action (default action, i.e., modifying composition string and web app specific action).

Makes sense to me. If authors are trying to detect "normal" key downs for arrows keys, etc... then they should not be listening to keydowns fired during composition.  If, on the other hand, they care about composition, then they should probably be listening to compositionupdate event instead.

I'll go talk with my colleagues and get back to you.

- R. Niwa

Received on Tuesday, 12 January 2016 05:03:17 UTC