Re: Proposal to ammend the composition event spec.

On Wed, Jun 16, 2010 at 1:46 AM, James Su <suzhe@google.com> wrote:

> 2010/6/16 Hironori Bono (坊野 博典) <hbono@google.com>
>
> Greetings,
>>
>> Even though your proposal looks great, I would like to clarify one
>> point: section 6.2.4 (*1) writes "cancelling the default action of a
>> keydown event must prevent its respective textInput event from being
>> generated." If I understand your proposal correctly, your proposal
>> seems cancelling the default action of a textInput event does not
>> affect its respective compositionend event. Therefore, your proposal
>> implies canceling the default action of a keydown event does not
>> affect its respective compositionend event, right? (Do we need to add
>> this sentence to section 6.2.4?)
>>
> It's not correct. Cancelling a keydown event should prevent the
> corresponding composition and textInput events from being generated.
>

I think Dan's proposed change doesn't affect section 6.2.4 (6.2.5 in the dev
version) since the keydowns in these cases would not generate textInput
events.

This is a separate discussion really, but I'm not sure it's possible to both
implement the keyCode/key properties on the keydown event on Mac and make
it cancelable for IME input. In order to get the keyCode/key, the IME has to
be sent the keydown first and once it's been given the keydown, there's no
way to rollback the IME state. One way to make
keydown cancelable cross-platform is to say that preventDefault on an IME
keydown cancels the composition entirely.

to type "wo" -> 我

user "w"  <-- Canceling keydown should prevent the composition from starting
and the DOM should not be modified.
event compositionstart
("w")

user "o"  <-- Not related to textInput since this keydown doesn't generate a
textInput event. One cross-platform solution would be to cancel the
composition.
("wo")

user <space>  <-- Same as above.
("我")

user <space> (to commit the composition) <-- Should cancel the textInput and
thus cancel the composition.
("")
event textInput (cancelable)
("我")
event compositionend

-Ojan

Received on Wednesday, 16 June 2010 21:39:31 UTC