Re: [w3c/editing] beforeInput: Unify "deleteContent" and "deleteComposedCharacter" (#118)

> Just to clarify UA should only fire `deleteComposedCharacter` during composition, but not for the deletion of final 'ComposedCharacter' after composition?

That is correct. If we are just deleting characters, outside the IME, this shouldn't matter.

> For example in Chinese IME:
> 1. Press 'n', (fire `insertText` with data='n')
> 2. Press 'u', (fire `insertText` with data='u')
> 3. Press 'backspace', (**fire `deleteComposedCharacter`** because it's still during composition)
> 4. Press 'i', (fire `insertText` with data='i')
> 5. Press 'space' to accept, (fire `insertText`|`replaceContent` with data='你')

This is where the entire composition string is being deleted and then reinserted, correct? So this would be two different events then (deleteComposedCharacter and insertText) of which the second should be cancelable.

> 6. Press 'backspace', (**fire `deleteContent`** because it's outside composition even if the character to be deleted is a composed character)

That is correct. It doesn't matter how the character was inserted originally. What matters here is that the entire action takes places outside the IME, which means the event can be canceled and the JS can do something alternative without breaking the browser.In the case of cE=typing, the browser will not do anything by default, so it relied entirely on a JS implementation of an editor. 

> I agree with @yosinch that having both is redundant since we already have [`isComposing`](https://w3c.github.io/uievents/#dom-inputevent-iscomposing)

The alternatives seem to be to say:

A) deleteCharacter can be canceled in all types of cE, and it has no default action in cE=typing, EXCEPT if it is triggered with isComposing=true.  If it it is triggered with isComposing=true, then it cannot be canceled and it does have a default action in cE=typing.

or:

B) deleteCharacter can be canceled in all types of cE and has no default action in cE=typing. deleteComposedCharacter cannot be canceled in any type of cE and has a default action defined in cE=typing.

On the JavaScript side of things it doesn't really matter if we choose A or B. So if this doesn't go against internal conventions for how your browser code is written, it probably makes more sense to use A (which is what you guys propose).  

The only issue I have is that the event definition in the ui events spec now says that the event is always cancelable whereas we really need to say that it is not cancelable under certain circumstances. 

---
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/118#issuecomment-209646801

Received on Wednesday, 13 April 2016 21:05:07 UTC