w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

Introduce inputType 'deleteByComposition' and fire before 'compositionstart' #33

Closed chong-z closed 7 years ago

chong-z commented 7 years ago

Background This is about replacing text. Usually we fire 'insertText' and assume it will replace current selection, and canceling it will prevent the entire replacement. However the first 'insertText' after 'compositionstart' is non-cancelable.

Proposal We should split the replacement into 1. deletion and 2. insertion for composition, and do the deletion before 'compositionstart'.

Applications

Notes

Related discussion https://github.com/w3c/input-events/issues/17#issuecomment-247704684

johanneswilm commented 7 years ago
  • Canceling 'deleteByComposition' will result in duplicated text
    • But this should be expected as you are canceling a deletion

This confused me at first, but I think I now understand that what you mean is that:

"Canceling 'deleteByComposition' will result in duplicated text unless the JS code removes the text in the targetRanges from the DOM"

I think this information should be included in an example we add to the spec, maybe a note, and not to do normative text, as it sounds slightly confusing.

chong-z commented 7 years ago

RESOLUTION: Yes we can do the issues 33/34 proposal for cancelable at each end of IME. https://www.w3.org/2016/09/22-webapps-minutes.html#resolution02