Text suggestions on Android with adjacent spaces are broken #15831
Labels
browser:android
domain:typing/ime
This issue reports a problem with standard typing & IME (typing method for CJK languages).
package:typing
type:bug
This issue reports a buggy (incorrect) behavior.
📝 Provide detailed reproduction steps (if any)
The following uses the
|
character to denote the caret position.Hello World
, these are two spaces in the middle.Hello | World
.te
which shows asHello te| World
in the editor.Test
.HelloTest | World
.✔️ Expected result
The typed in part
te
should be replaced withTest
.❌ Actual result
The word is inserted at an incorrect position.
❓ Possible solution
I have the strong suspicion that this is the result of a whitespace mismatch as outlined in my findings in both #14707 and #13994. This is not resolved by my workaround described in #13994 (comment) which is to be expected since it’s a rather defensive approach and only targets the end of the string.
Inspecting the DOM for
Hello | World
shows that the content isHello\u0020|\u00a0World
which means that to the left of the caret is a regular space which from my experience can throw off the composition replacement when the editor swaps it our for\u00a0
. I can imagine that my workaround above can be adapted to cover this case too, possibly requiring a two-pass diff to first figure out the changes and then probe if the position of the change is similar, virtually ignoring the content to the right of the caret.📃 Other details
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: