RESOLVED FIXED327414
[GTK][WPE] Input method delete-surrounding that splits a character leaves a selection behind or puts the caret inside it
https://bugs.webkit.org/show_bug.cgi?id=327414
Summary [GTK][WPE] Input method delete-surrounding that splits a character leaves a s...
Simon Pena
Reported 2026-10-13 09:21:57 PDT
When a delete-surrounding range ends inside a character or a grapheme cluster: - After "a👨‍👩‍👦", a ZWJ sequence, delete-surrounding(-2, 2) deletes nothing and leaves the last emoji of the sequence selected. The next character typed replaces it. - After "a😀b", delete-surrounding(-2, 0), a caret move, puts the caret between the two halves of the emoji's surrogate pair. WebPage::deleteSurrounding() sets the selection to the requested range and deletes it. When the delete does nothing, the selection is not restored. Expected: a range that splits a character never leaves a selection behind, and a caret move never lands inside a character. Either do nothing and keep the caret where it was, or round the range to whole characters. Found with API tests while looking at bug 327412.
Attachments
Simon Pena
Comment 1 2026-10-13 10:11:16 PDT
In a password field, the same split delete corrupts the text instead of doing nothing. API test, with the caret after "a😀" and delete-surrounding(-1, 1): - <input>: "a😀", nothing deleted. - <textarea>: "a😀", nothing deleted. - <input type="password">: "a\ud83d", the low half of the surrogate pair is deleted and a lone high surrogate is left in the value. Also seen on Android with wpe-android, where the keyboard is not told the text of password fields and sends a delete of 1 after an emoji.
Fujii Hironori
Comment 2 2026-10-25 21:12:24 PDT
EWS
Comment 3 2026-10-26 02:01:54 PDT
Committed 324679@main (458b3214334b): <https://commits.webkit.org/324679@main> Reviewed commits have been landed. Closing PR #78276 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.