Skip to content

fix(textbox): Place caret by X on a tap above the text (backport #25489) - #25955

Merged
agneszitte merged 2 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25489
Nov 3, 2026
Merged

agneszitte merged 2 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25489

Conversation

@mergify

@mergify mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes unoplatform/kahua-private#531

PR Type:

🐞 Bugfix

What changed? 🚀

On Skia, tapping a TextBox in 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.GetIndexAt returned index 0 for any point above the first line (p.Y < 0) when extendedSelection is 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:

  • TextBox mouse click, drag-select and right-tap
  • TextBlock selection (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_Line
    • When_Mouse_Drag_Above_Text_Selects_By_X

    All of them fail without the fix, with the caret at 0, and pass with it (Skia desktop).

  • The full Given_TextBox / Given_TextBlock / Given_PasswordBox suites (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.7 after merge.

PR Checklist ✅

🤖 Generated with Claude Code


This is an automatic backport of pull request #25489 done by [Mergify](https://mergify.com).

@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Nov 3, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@agneszitte
agneszitte merged commit db81df4 into release/stable/6.7 Nov 3, 2026
33 of 46 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-25489 branch November 3, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants