[webkit-dev] Handling IME composition events

Joone Hur joone at kldp.org
Wed Jul 28 08:45:48 PDT 2010

Hello all,

I’m working on a Hangul(Korean alphabet) composition issue in WebKit.
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.

However, all ports of WebKit handle composition events in inconsistent
ways. Even keyboard events are still dispatched to the DOM during a

Therefore, it is necessary to fix those problems as follows:
1) IME Composition events should be handled consistently in all ports of WebKit.
2) The textInput event should be dispatched after a compositionend event.
3) Keyboard events should not be dispatched during a composition.

The following link shows an example of testing composition events with
the major WebKit based browsers.
I was wondering what is a good example of handling composition events.
In my opinion, the composition events should be dispatched as follows
if we follow the W3C DOM Level3 events.

For example, when we type ‘rksk’ for inputting ‘가나' using Korean IME,

Type ‘r(ㄱ)’
1. compositionstart
2. input

Type  ‘k(ㅏ)
3. compositionupdate
4. input

Type ‘s(ㄴ)’
5. compositionupdate
6. input

Type ‘k(ㅏ)’
7. compositionend (for 가)
8. textInput
9. input
10. compositionstart
11. input

mouse press
12. compositionend (for 나)
13. textInput
14. input

Currently, Firefox, Chrome, and Safari don’t handle composition events
like this because they seem not to follow the W3C specification on IME
composition events yet. So I filed a bug for this issue.

I would be grateful if you could give me your opinion on this issue.



More information about the webkit-dev mailing list