Repository navigation
fix(textbox): Place caret by X on a tap above the text (backport #25489) - #25955
Merged
agneszitte merged 2 commits intoNov 3, 2026
Merged
Conversation
2 of 5 tasks
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
agneszitte
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
GitHub Issue: closes unoplatform/kahua-private#531
PR Type:
🐞 Bugfix
What changed? 🚀
On Skia, tapping a
TextBoxin its top border or padding (the few pixels above the text line) moved the caret to the start of the text, whatever the tap's X position. On a tablet, a finger tapping to the right of the content often lands there. The result looks random: the caret goes to the end on one tap and to the start on the next. This was reported on iPad (Skia WebAssembly).Cause:
UnicodeText.GetIndexAtreturned index 0 for any point above the first line (p.Y < 0) whenextendedSelectionis true.Fix: a point above the text now hit-tests the first line by its X position, the same way a point on that line does. This matches master, where the same logic arrived with the RichEditBox parity port (#23924), which is too large to backport. Points below the text are unchanged.
Because the fix is in the shared hit-test, it also changes these paths when the pointer is above the first line:
IsTextSelectionEnabled)Each of them now follows the pointer's X position on the first line instead of jumping to index 0. That is master's current behaviour.
Validation:
New runtime tests:
When_Touch_Tap_Above_Text_Places_Caret_By_X_{Android,iOS}When_Touch_Tap_Above_Multiline_Text_Uses_First_LineWhen_Mouse_Drag_Above_Text_Selects_By_XAll of them fail without the fix, with the caret at 0, and pass with it (Skia desktop).
The full
Given_TextBox/Given_TextBlock/Given_PasswordBoxsuites (375 tests) differ only by the new tests with and without the fix. The one other test that changed,When_Touch_LongPress_Shows_Grippers_Android, failed once in the run without the fix. It passed 6/6 on its own without the fix and doesn't go through this code, so that was a timing flake.Checked on a real iPad (Skia WebAssembly SamplesApp, Safari). A tap on the top border goes to the start without the fix, and to the end with it.
To be backported to
release/stable/6.7after merge.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
This is an automatic backport of pull request #25489 done by [Mergify](https://mergify.com).