[webkit-dev] Handling IME composition events

Oliver Hunt oliver at apple.com
Wed Jul 28 11:13:56 PDT 2010


On Jul 28, 2010, at 8:45 AM, Joone Hur wrote:

> Hello all,
> 
> I’m working on a Hangul(Korean alphabet) composition issue in WebKit.
> https://bugs.webkit.org/show_bug.cgi?id=40518
> By the way, I noticed that WebKit based browsers are inconsistent with
> IME composition events.
> 
> According to the W3C DOM Level 3 events(http://bit.ly/bM7YVQ),
> 1) A browser should fire compositionstart, compositionupdate, and
> compositionend event during a composition.
> 2) The textEvent event should be dispatched after a compositionend
> event if the composition has not been canceled.
> 3) While a composition session is active, keyboard events should not
> be dispatched to the DOM (i.e., the text composition system "swallows"
> the keyboard events), and only compositionupdate events may be
> dispatched to indicate the composition process.
The DOM Level 3 event model for input composition does not match the requirements of actual web content.  This is unfortunate, but will hopefully be fixed in future.

> 
> However, all ports of WebKit handle composition events in inconsistent
> ways. Even keyboard events are still dispatched to the DOM during a
> composition.
> 
> Therefore, it is necessary to fix those problems as follows:
> 1) IME Composition events should be handled consistently in all ports of WebKit.
I'm not sure this can be achieved as it depends (to an extent) on the platform IME system, and the active IME -- different IMEs have completely different behaviours making consistent behaviour across multiple platforms is an exercise in futility.

However if you're seeing different behaviour with the same IME on a single platform that's a bug.

> 2) The textInput event should be dispatched after a compositionend event.
Unsure of the specifics of this.

> 3) Keyboard events should not be dispatched during a composition.
Key events must be sent while an IME is active otherwise sites break.  IIRC you get keydown and keyup events, but not keypress.  The keydown event when an IME is active has charCode 229 in order to be compatible with IE.

--Oliver



More information about the webkit-dev mailing list