Clear text area after finalizing composition #4265
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clear text area after finalizing composition
Previously stale text would display from text area in the composition helper when it heard the composition character. On some IMEs like GBoard this would manifest as the text propitiating after tapping delete, on others like the Samsung keyboard it would happen from tapping space. See attached videos for examples of before and after.
This PR clears the text area by setting
_textArea.value = ''
after finalizing the composition so when the composition is next started it does not contain the stale text and display it upon starting a new composition.Previously I thought this change broke character composition, but after looking closer at
Compostionhelper.test.ts
and some additional manual testing to ensure everything works it seems the tests were checking for the presence of the uncleared_textArea
text.Before
Gboard Example:
before-en-pixel.mp4
Samsung Keyboard Example:
before-en-sm-kb.mp4
After
Samsung Keyboard (kr):
after-kr.mp4
Samsung Keyboard (en):
after-en.mp4