Open rniwa opened 7 years ago
@choniong @whsieh @ojanvafai
@rniwa Isn't the current setup the same as your option 2 as the entire composition string is deleted with a non-cancelable "deleteCompositionText"
before the "insertFromComposition"
?
Also, see this note: https://w3c.github.io/input-events/#h-note4
(Wrong button sorry...)
Same as what @johanneswilm said, but the assumption was UA always do full text replacing.
In fact we probably want to loose the restriction as UA might want to optimize the replacing algorithm (e.g. To preserve style.) when 'insertFromComposition'
was not cancelled. Will file a separate issue for this.
Thank you for your responses, @johanneswilm and @choniong! To reiterate, when the user commits the composed text to the DOM, we:
Does this sound right?
@whsieh Yes, that sounds right.
When
insertFromComposition
is canceled, we can't continue to have the text being composited since UA doesn't have the capability to keep input methods and keyboards open in some platforms. i.e. we need to remove the currently composting text from DOM.There are two behaviors we can implement:
Fire another
insertCompositionText
to replace the composition with an empty string wheninsertFromComposition
is canceled. Before firinginsertFromComposition
, fire anotherinsertFromComposition
to replace the composition text with an empty string just like we do indeleteByComposition
before starting composition. (1) is weird because it would mean that we would fire an extra composition event after the composition had logically ended.(2) makes sense because we already delete the existing content with
deleteByComposition
before entering input methods in reconversion case. We're simply following the same pattern when we're exiting the composition by first emptying the composing text, and then inserting the confirmed text.