[w3c/editing] [beforeinput] Should we allow canceling the committed text from IME? (#128)

Currently all events between `compositionstart` and `compositionend` are non-cancelable, and there shouldn't be remaining DOM update in and after `compositionend`.

So to override text insertion developers have to
1. Override `insertText` for normal typing
2. And use a `cE=typing` container to handle IME (See #76 #84)

Will it be better if we can make the last `insertText` for composition cancelable? So developers only needs to do 1.

---

For example with Hiragana IME:

_(Press key labeled as `a`)_
1. `compositionstart`
2. `beforeinput` (`insertText`, `data`='あ')
3. `compositionupdate` (`data`='あ', displays with underscore)

_(Press `Space` twice to open selection box and switch to next possible character)
(Events for the second `Space`)_
4. `beforeinput` (`deleteComposedCharacterBackward`, deletes 'あ')
5. `beforeinput` (`insertText`, `data`='方')
6. `compositionupdate` (`data`='方', displays with underscore)

_(Press `Enter` twice to Accept selection and Commit text)
(Events for the second `Enter`)_
7. `beforeinput` (`deleteComposedCharacterBackward`, deletes '方' **with underscore**)
**8. `beforeinput` (`insertText`, `data`='方', no underscore)**
9. `compositionupdate` (`data`='方', **no underscore**)
10. `compositionend` (`data`='方')


So my question is can we make 8. cancelable? (At this point IME should have finished and UA only need to remove underscores.)

---

Also am I using `deleteComposedCharacterBackward` correctly? It seems a little bit weird to fire two `beforeinput` for one `compositionupdate`...

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/128

Received on Tuesday, 3 May 2016 16:01:07 UTC