RE: Composition events (was: contentEditable=minimal)

+Gary/Masayuki who can help with deciphering DOM L3 Events :-)

-----Original Message-----
From: Robin Berjon [mailto:robin@w3.org] 
Sent: Tuesday, May 27, 2014 2:15 AM
To: Ben Peters; Jonas Sicking
Cc: public-webapps@w3.org
Subject: Composition events (was: contentEditable=minimal)

On 27/05/2014 01:52 , Ben Peters wrote:
> Composition Events for IMEs, CommandEvents with type insertText for
> all text input (including after Composition Events for IMEs)

I think we should be careful not to mix up composition events and IMEs. 
They may happen together, but IMEs have their own specific issues (e.g. 
popping up a window) that inline composition does not necessarily have. 
Also, IMEs can happen without composition: you could arguably popup a 
handwriting IME that would just insert text on commit without any 
composition taking place.

To stick to what I think is the simplest case, diacritic composition, 
here is what I believe the current D3E specification says (not that it's 
really clear on the matter, but I'm assuming best case scenario). For ñ 
you basically get:

   compositionstart "~"
   compositionend "ñ"

 From what you're saying above you'd like to replace that with:

   compositionstart "~"
   input "ñ"

I think we can make that work, it drops on event and moves the code 
around. If you look at the "Twitter Box" code:

 
https://gist.github.com/darobin/8a128f05106d0e02717b#file-twitter-html-L102

It basically would need to move what's in the compositionend handler 
inside the beforeinput handler, with a check to see if compoRange exists 
(or the event has isComposing=true).

(I'm assuming that compositionupdate stays as is since we need to update 
the rendering with it.)

Is that the sort of flow you had in mind?

PS: note I just noticed that the code in the Gist was not the latest I 
had and had a lot of "TODO" bits - I've udpated it to the latest.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Tuesday, 27 May 2014 18:18:28 UTC