Re: [editing-explainer] How does cE=typing support IME text replacement? (#34)

Here is a breakdown the characteristics of each feature as I understand them:

**Overtype**: intent is to replace a range with new content. Range coincides with Selection.

**Spellcheck/Autocorrect**: intent is to replace an arbitrary range with new text. Also, some ranges may get decorated by the UA (red squiggles).

**IME**: replaces arbitrary range with new content. Some ranges may get decorated by UA. UA may also create interactive dialogs/pickers and may capture the focus to allow interaction with these. UA may want to temporarily replace a range with new content when user hovers over a choice.

-------------------------------------
We can see that content replacement is a common element to all. I'd be in favor of using a common "replace" intent that includes a range and the new text. That intent would probably indicate whether the intent came from overtype or autocorrect or something else, but the editor dev will treat it all the same. The Range could cross style boundaries.

Text decoration by the UA is also present. In my view the editor dev doesn't really need to know about that, as long as the UA is able to do the decoration internally without affecting the dev-facing DOM. This is currently the way things work in cE=true (I think?) and it's fine IMO.

IME brings some special behaviors to the table. I feel like the biggest gotcha with IMEs is that if the editor dev does something unexpected (like resetting the Selection, as was noted elsewhere) the IME will commit automatically. We might consider adding some sort of signaling (events or maybe attributes on Selection) to help editor devs avoid breaking IMEs.

The other trick about IMEs is that they like to replace text in the editor on a temporary basis (mouseover a choice). We might consider adding a "temporary" flag to the replace intent. This would instruct the dev editor to execute the replacement in the View, but that it is not meant to be committed to disk or sent over the network or whatever.

(I'm not very familiar with IMEs. Are there other things they do we should be considering here?)

So I think that if we have a Replace Intent with "temporary" flag, and we allow the UA to decorate editable text, and we add some signaling on the state of IME input, we're most of the way there. 


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing-explainer/issues/34#issuecomment-73174677

Received on Friday, 6 February 2015 02:51:29 UTC