Bug 16329 - compositionstart should not be cancellable for IME
Summary: compositionstart should not be cancellable for IME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - DOM3 Events (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL: https://www.w3.org/2008/webapps/track...
Keywords: LC, reviewerSatisfied
Depends on:
Reported: 2012-03-12 20:26 UTC by Travis Leithead [MSFT]
Modified: 2012-03-20 17:33 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Travis Leithead [MSFT] 2012-03-12 20:26:44 UTC
PORT: ISSUE-183: (This bug will be used to track this LC comment.)

DOM3 Events Spec defines that compositionstart is cancelable. But it 
doesn't make sense for IME at least.
UA doesn't know which key event causes starting composition. It is 
decided by IME. Current UAs dispatch compositionstart when IME starts 
composition actually.
Therefore, "This event must be dispatched immediately before a text 
composition system is launched", this definition doesn't match current 
And also the composition has started already at that time. Therefore, 
"If this event is canceled, the text composition system must not be 
launched.", this explanation is impossible behavior.
I'm not sure for other input methods. I think that the spec should 
document the IME case at least.
Comment 1 Travis Leithead [MSFT] 2012-03-17 00:01:20 UTC
I had some help, and tested the Japanese IME on Microsoft Windows 7 machine running IE9 (which supports these composition events as speced). 

The IME application will be running and enabled down in the notifiation area. If I do nothing with the composition events as they fire, my first keystroke in an edit area will start a composition (underlining the text as it's not yet been fully composed).

When I cancel the compositionstart event, the behavior I see is that no text is entered into the edit control when I type. The compositionend event will fire immediately after the composition start signalling that the composition was terminated. 

This behavior seems in line with the spec, so I'm not sure that what the spec says is impossible to implement.

However, it's very possible that I have some bad terminology in the spec. So, without changing the cancelable nature of compositionstart, how would you suggest this be better phrased?
Comment 2 Masayuki Nakano 2012-03-17 06:46:24 UTC
It's not canceling *launching* composition. The composition has been actually started and IE canceled the *started* composition. So, even if you cancel the composition, it cannot cause alternative keypress event for the pressed key.

And this behavior can be only on some platforms which can discards the composition string. E.g., GTK doesn't have such APIs in its IM module.

> However, it's very possible that I have some bad terminology in the spec. So,
> without changing the cancelable nature of compositionstart, how would you
> suggest this be better phrased?

I think that spec should say "it depends on the platform or IME whether it's cancelable by calling preventDefault() of compositionstart." at least.

However, I believe such difference between platforms must not be good thing for Web application developers because most of them must not familiar with every platform's APIs. Therefore, it *might* be better if it's impossible to cancel composition (only when it's caused IME) on all browsers.

Or it might be better if there is an API in CompositionEvent for canceling the composition. E.g., "bool CompositionEvent.cancelComposition();". Then, we developers can see whether it succeeded or not.
Comment 3 Travis Leithead [MSFT] 2012-03-19 20:19:25 UTC
To primarily address this bug, I will be changing the "must" requirement to a "should" implying that wherever possible, an implementation *should* allow the composition session to be cancelable; however, if an implementation can't for legitimate reasons (like not having the API to do so), then it's OK.

In addition, for both our sakes, I'll be updating the spec to get rid of the "launching" text, and be more specific in describing the composition process from compositionstart to compositionend as a "composition session" that is maintained by the "text composition system". This will include minor updates throughout section
Comment 4 Travis Leithead [MSFT] 2012-03-20 01:22:03 UTC
Updated text has been added to the spec. Please review:

Comment 5 Masayuki Nakano 2012-03-20 01:59:05 UTC
Looks OK. Thank you.