Skip to content

fix: Cull text grippers instead of locking scroll - #24132

Merged
Xiaoy312 merged 7 commits into
masterfrom
dev/xygu/20260819/textbox-scroll-lock-removal
Aug 24, 2026
Merged

Xiaoy312 merged 7 commits into
masterfrom
dev/xygu/20260819/textbox-scroll-lock-removal

Conversation

@Xiaoy312

@Xiaoy312 Xiaoy312 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: Tracked internally — no public issue for this one.

PR Type:

🐞 Bugfix

What changed? 🚀

Current behavior. While a TextBox held a live touch caret — the Android insertion handle, or a full touch selection — an enclosing ScrollViewer refused to scroll away from it. ScrollViewer.ClampOffsetsToFocusedTextBox rewrote the offset back onto the TextBox after every scroll, and ScrollContentPresenter discarded touch inertia outright to make the clamp land. The user-visible result was a form that could not be scrolled past the field they had just tapped.

That clamp existed to hide a different defect: the selection grippers are drawn in a popup that no ScrollViewer clips, so once the TextBox scrolled out of view they kept painting at their old screen position — over the app's status/nav bar, or over whatever the scroll had moved under them. Pinning the scroll meant the TextBox could never leave the viewport, so the grippers never got the chance to strand.

This PR removes the scroll lock and fixes the gripper problem where it belongs:

  • TextSelectionGripperPresenter.Update now culls each gripper against the host's ancestor-clipped bounds (GetGlobalBoundsWithOptions(ignoreClipping: false, …)) rather than its raw bounds. A TextBox scrolled out of an enclosing ScrollViewer still has valid raw bounds, which is why the old test passed while the grippers stranded.
  • Culling probes the point the thumb hangs from — the bottom-center of the caret line — not the caret line as a whole. A line only fractionally visible at the clip edge would otherwise still paint a full thumb past it. This matches what native Android checks (Editor.HandleView.isPositionVisible). The probe is a 1px rect rather than a bare point, because both sides of the test come from float matrices and a caret line ending flush with the clip (a selectable TextBlock's last line) must not flicker on rounding.
  • A culled gripper's popup is closed, and the next ShowAt reopens it when the anchor scrolls back into view. That is only safe because the per-frame reposition is driven by a single presenter-level CompositionTarget.FrameRendered subscription keyed on the gripper mode — not by the popups, and not once per showing gripper — so the loop keeps ticking with every popup closed. Leaving them open would report a popup through the public VisualTreeHelper.GetOpenPopupsForXamlRoot that WinUI never exposes.
  • A gripper holding the pointer capture is never culled. Closing the popup unloads its child, and unloading an element releases its pointer captures (UIElement.Pointers.ClearPointersStateOnUnload), so culling mid-drag ends the gesture: the remaining moves are dropped and the release never reaches the gripper, leaving the selection toolbar closed too. The accepted cost is a dragged gripper painting outside the clip until the finger lifts; native avoids even that by auto-scrolling the container when a handle reaches the edge, which we don't do.
  • A throw escaping Update is contained and reported once — the subscription outlives gripper visibility, so it would otherwise take the window's render loop with it. The cull transition logs the anchor and the clip at Trace, so an empty clip (GripperClipBounds computing nothing for an out-of-tree or zero-sized host) is distinguishable from the anchor genuinely having scrolled away.
  • ScrollViewer.ShouldSnapToTouchTextBox / ClampOffsetsToFocusedTextBox and the matching inertia special-case in ScrollContentPresenter.Managed are gone. The thumb side length is now a named constant (CaretWithStemAndThumb.ThumbSize) shared by the gripper layout and the culling math, instead of a 16 repeated in both.

⚠️ Behavior change worth a reviewer's eye (no API surface changes — everything removed was internal/private): a focused TextBox with a touch caret no longer pins its ScrollViewer. That is the point of the fix, but it does reverse a previously-asserted behavior. When_Touch_Focused_Then_Scrolled_Away asserted the TextBox stayed pinned inside its ScrollViewer; it is renamed to When_Touch_Focused_Then_Scrolled_Away_The_Scroll_Sticks and now asserts the opposite — the user's scroll sticks and the box is allowed to leave the viewport. The gripper stranding that the old assertion was really protecting against is covered directly instead (see below).

Intended behavior, for the record: a focused element is scrolled into view on focus — it is not permanently locked there. A user scroll expresses intent and must always override it. Focus-driven bring-into-view is untouched by this PR and still covered by When_GotFocus_BringIntoView and When_OuterScrollViewer_BringIntoView_Scrolls_To_Caret.

Test coverage

Eight runtime tests in Given_TextBox.skia.cs (Skia Desktop + Skia Android, for the mobile touch conventions) and one in Given_TextBlock.cs:

Test Guards
When_Touch_Tap_Does_Not_Lock_ScrollViewer_Android Android insertion handle doesn't pin the scroll
When_Touch_Tap_Empty_Does_Not_Lock_ScrollViewer_Android …same for an empty field, which now places the handle like a filled one
When_Touch_Selection_Does_Not_Lock_ScrollViewer_Android / _iOS Two-thumb selection, both conventions
When_Touch_Selection_Flick_Does_Not_Lock_ScrollViewer_Android The ScrollContentPresenter inertia half — the timer tests alone would still pass if inertia stayed hijacked
When_Scrolled_Out_Of_View_Grippers_Are_Hidden Handle hides when the box scrolls out, and comes back when it scrolls in
When_Caret_Line_Straddles_Viewport_Edge_Grippers_Are_Hidden The anchor-point culling rule a few px either side of the edge, plus the thumb ink in the band below the viewport — present while the anchor is inside (the accepted sub-thumb-height overhang), gone once culled
When_Gripper_Dragged_Past_Viewport_Edge_Drag_Keeps_Tracking A gripper drag survives its anchor crossing the clip edge
Given_TextBlock.When_IsTextSelectionEnabled_Scrolled_Out_Of_View_Then_Hides_Grippers The selectable-TextBlock host, which takes the same clip change

The five *_Does_Not_Lock_* tests assert the box ended up outside the viewport rather than that the offset cleared a threshold: the old clamp's target was the box's own offset inside the content, which clears any threshold low enough to be safe. Verified by injecting the clamp's exact result (ChangeView(null, 120, …)) immediately before the assert — all five fail, and pass again once it is removed.

Two notes for reviewers on test timing. Several tests wait on the scroll-end snap timer (FeatureConfiguration.ScrollViewer.SnapDelay) plus a margin, since that timer is what the old lock fired from — if any prove flaky on slower CI agents, the waits are the place to look. And WindowHelper.WaitForIdle pumps the dispatcher without necessarily producing a rendered frame, while culling and repositioning only happen in the per-frame Update: tests that depend on either wait on the gripper's own reported position, or put a real delay between injected pointer moves. Back-to-back injected moves never yield to the renderer at all, which silently passed two of these tests before it was caught.

Known gaps, tracked separately

Accepted in this PR, so a reviewer doesn't have to re-derive them:

  • A thumb whose anchor sits just inside the clip edge still overhangs it by up to ThumbSize (16px). That is the deliberate rule — native Android probes the same anchor point — and When_Caret_Line_Straddles_Viewport_Edge_Grippers_Are_Hidden asserts that ink is there.
  • A gripper drag is not auto-scrolled when the handle reaches the container edge, so a drag past the clip keeps painting outside it until the finger lifts. Native scrolls the container instead; we don't, and cutting the drag short is the worse of the two.
  • The ancestor clip walk behind GetGlobalBoundsWithOptions builds an SKPath only to read its Bounds, which costs native Skia ops per clipping ancestor on a per-frame path and loses rotation. It makes this PR cull less, never more, so it is a follow-up rather than a prerequisite — Add a rect-only ancestor clip query instead of building an SKPath in GetGlobalBoundsWithOptions #24163.
  • The SelectionFlyout gets none of this treatment: it is positioned once at show time, so a scroll that doesn't press on the text leaves it parked over unrelated content — Skia: the text SelectionFlyout stays parked on screen when its selection scrolls out of view #24164. Pre-existing, and out of scope here.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable)
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — n/a, no public API or documented behavior surface
  • 🖼️ Validated PR Screenshots Compare Test Run results. — pending first CI run
  • ❗ Contains NO breaking changes — no API changes; see the behavior-change note above
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code

A live touch caret in a TextBox pinned its enclosing ScrollViewer: the
offset was rewritten back onto the TextBox after every scroll and touch
inertia was discarded outright, leaving forms the user could not scroll
away from.

Remove that clamp and fix the defect it was working around - selection
grippers live in a popup no ScrollViewer clips, so they kept painting at
their old screen position once the TextBox scrolled out of view - by
culling them against the host's ancestor-clipped bounds instead. Culling
tests the point the thumb hangs from rather than the caret line as a
whole (as native Android does), so a line straddling the viewport edge no
longer paints a whole thumb past it.

This supersedes the scroll-lock workaround; the test that asserted the
TextBox stayed pinned now asserts the user's scroll sticks, and gripper
culling is covered directly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 19, 2026 17:25
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Skia text-selection behavior so touch selection/caret grippers are culled when their host text control scrolls out of view, instead of “locking” an enclosing ScrollViewer to keep the focused TextBox on-screen. It removes the prior scroll-offset clamping and inertia special-casing, and adds runtime tests to ensure scrolling remains responsive while preventing offscreen grippers from painting over unrelated UI.

Changes:

  • Cull text-selection grippers against ancestor-clipped bounds (and an anchor-point probe) so handles stop painting when scrolled out of view.
  • Remove Skia-only ScrollViewer offset clamping / “snap-to-touch-TextBox” behavior and the related inertia handling.
  • Add/adjust runtime tests validating scrolling is not locked by touch caret/selection and that grippers hide/show correctly as content scrolls.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs Uses ancestor-clipped global bounds for gripper culling.
src/Uno.UI/UI/Xaml/Controls/TextBlock/TextBlock.skia.cs Uses ancestor-clipped global bounds for gripper culling (matching TextBox).
src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.SnapPoints.cs Removes Skia clamp-to-focused-TextBox adjustment and related partial hook.
src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.skia.cs Removes Skia “snap-to-touch-TextBox” implementation (scroll lock behavior).
src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs Stops arming snap logic based on the removed touch-TextBox snapping condition.
src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.Managed.cs Removes inertia/snap special-casing tied to the removed touch-TextBox snapping.
src/Uno.UI/UI/Xaml/Controls/Primitives/TextSelectionGripperPresenter.skia.cs Culls grippers using an anchor-point probe; collapses (culls) instead of hiding/closing.
src/Uno.UI/UI/Xaml/Controls/Primitives/CaretWithStemAndThumb.skia.cs Introduces ThumbSize, adds Cull() behavior (collapse without closing popup), and a test hook.
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs Adds runtime tests for “no scroll lock” + gripper culling; updates legacy scroll-away assertion.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@unodevops

Copy link
Copy Markdown
Contributor

Xiaoy312 and others added 2 commits August 19, 2026 14:12
Cull() collapses the gripper, and collapsing an element releases its
pointer captures (UIElement.Pointers.ClearPointersStateIfNeeded). So
culling the gripper the finger is holding aborted the drag mid-gesture:
the remaining moves were dropped and the release never reached the
gripper, leaving the selection toolbar closed too.

Reachable since the grippers started culling against the ancestor-clipped
bounds rather than the raw ones - a partially-scrolled-out control never
culled before, so a drag inside one could not cross the clip edge.

The trade is that a dragged gripper may paint outside the clip for the
duration of the gesture: transient, and under the finger. Native avoids
even that by auto-scrolling the container at the edge, which we don't do.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Both grippers subscribed to CompositionTarget.FrameRendered individually
and invoked the same TextSelectionGripperPresenter.Update, so a two-thumb
selection ran the whole reposition pass - the ancestor-clip walk behind
GripperClipBounds included - twice per rendered frame. Culled grippers
kept their subscription too, so the doubling outlived their visibility.

Move the loop to the presenter and key it on GripperMode instead of the
popups' open state. Bootstrap is unchanged: the subscription was already
established from inside Update (via ShowAt), which is the only entry point.

CaretWithStemAndThumb no longer needs the reposition callback, nor the
Popup.Closed handler that existed only to unsubscribe.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228718 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • Focus_FocusVisual_Properties.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • DisplayInformation.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ImageIconPage.png-dark
    • ButtonClippingTestsControl.png-dark
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AppBarToggleButtonTest.png
    • ApplicationViewSpanningRectsPage.png
    • AppWindowPositionAndSize.png
    • AppXamlDefinedResources.png-dark
    • Attributed_text_FontSize_Changing.png
    • AutoBorderStretchwithbottommargin.png
    • AutomationPropertiesExtensions_Role.png
    • AutoSuggestBox_BitmapIcon.png
    • AutoSuggestBox_Description.png-dark
    • BasicThemeResources.png
    • Battery.png-dark
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • Border_Clipped_Change_Property.png-dark
    • Border_Clipped_Change_Property.png
    • Border_CornerRadius_with_Opacity.png-dark
    • Border_CornerRadius_with_Opacity.png
    • Border_With_Off_Centre_RotateTransform.png
    • Border_With_Off_Centre_ScaleTransform.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming

@ajpinedam ajpinedam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direction here is right — culling at the GripperClipBounds seam is where this belongs, and removing the clamp has nice side benefits: the unchecked (TextBox)FocusManager.GetFocusedElement(XamlRoot!)! cast is gone, and managed scrolling drops a focused-element lookup + ancestor walk from every scroll-end and inertia start.

Two things look merge-gating (details inline):

  1. Culling can kill a live gripper drag — collapsing the gripper releases its pointer capture mid-drag.
  2. Four of the five *_Does_Not_Lock_* tests pass even with the old lock restored — the assert thresholds sit below the clamp target.

Also, heads-up: this overlaps with #24099 (mine), which removes the same clamp with a content-root-driven culling design. We should pick one mechanism rather than merge both — happy to discuss which parts of each to keep.

The remaining inline notes are hardening/test-fidelity: consequences of keeping the culled popup open as the frame driver, silent-cull diagnosability, and a selectable-TextBlock coverage gap. Nits, no inline needed: a UTF-8 BOM was added to three previously BOM-less files; and since the clip used is clipPath.Bounds (axis-aligned bbox), rotated ancestors over-approximate and never cull — fine, but worth a code comment.

One more: the PR body already flags the behavior reversal — worth confirming on the internal item that introduced the pin that keep-in-view wasn't itself the requested UX, so we're not reversing a product decision.

Copilot AI review requested due to automatic review settings August 20, 2026 02:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Test fidelity:
- The *_Does_Not_Lock_* tests asserted a "did we scroll at all" offset
  threshold of 100, but the clamp's target was the box's own offset in the
  content (fillerAbove = 120), so all five passed with the lock in place.
  They now assert the box is fully outside the viewport. Verified by
  injecting ChangeView(120) - the clamp's exact result - before the assert:
  all five fail, and pass again without it.
- The straddle test waited on WaitForIdle, which pumps the dispatcher
  without necessarily producing a rendered frame, so "still showing" could
  pass on a frame that never ran. It now waits on the gripper's own
  reported position, and asserts on the thumb ink in the band below the
  viewport - present while the anchor is inside, gone once culled - so the
  culling tests no longer only assert the flag Cull() sets.
- Selectable TextBlock had no culling coverage despite taking the same
  ancestor-clipped GripperClipBounds; added the mirror test.
- Spelled out the leave-the-viewport assertion in the scroll-away test as
  an explicit non-intersection check.

Hardening:
- Contain and report a throw escaping Update: the frame subscription now
  outlives gripper visibility, so an exception would take the window's
  render loop with it.
- Trace log on the cull transition, naming the clip - an empty one means
  GripperClipBounds computed nothing rather than the anchor scrolling away.
- Note that the clip is an axis-aligned bbox, so rotated ancestors
  over-approximate.
- _popup?.IsOpen is true, per CodeQL.
- Restore the files' original absence of a UTF-8 BOM.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228809 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • Buttons.png-dark
    • Buttons.png
    • ImageIconPage.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • CalendarView_Theming.png
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • ApplicationViewSizing.png
    • AppWindowPresenters.png-dark
    • Arrange_Performance01.png
    • AutomationPropertiesExtensions_Role.png-dark
    • AutoSuggestBox_Description.png
    • Basics Pivot Test.png
    • BeginTime_MultipleAnimations.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • Border_Clipped_Change_Property.png-dark
    • Border_Clipped_Change_Property.png
    • Border_Simple.png-dark
    • Border_Simple.png
    • Border_With_ScaleTransform.png-dark
    • Border_With_ScaleTransform.png
    • CalendarDatePicker_Basics.png-dark
    • CalendarDatePicker_Basics.png
    • ChatBox.png-dark
    • ChatBox.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Uno_Web.Http.CookieManagerTests

Copilot AI review requested due to automatic review settings August 20, 2026 17:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/Uno.UI/UI/Xaml/Controls/Primitives/TextSelectionGripperPresenter.skia.cs:180

  • In OnFrameRendered, Update() exceptions are caught and (mostly) suppressed, but the presenter remains subscribed to CompositionTarget.FrameRendered. If the underlying exception is persistent, this will keep throwing/catching every rendered frame (CPU cost, noisy diagnostics) for the lifetime of the window. Consider unsubscribing (and optionally hiding the grippers) on the first failure to stop the per-frame exception loop.
		catch (Exception e)
		{
			// First failure only: it would otherwise repeat every rendered frame.
			if (!_repositionFailureLogged)
			{

@unodevops

Copy link
Copy Markdown
Contributor

Xiaoy312 and others added 2 commits August 20, 2026 17:19
An open popup is observable through the public
VisualTreeHelper.GetOpenPopupsForXamlRoot, and WinUI exposes nothing of
the sort - so a text field the user tapped several scrolls ago should not
still be reporting one.

Collapsing rather than closing was only needed while the popup drove the
per-frame reposition. It doesn't any more: the loop is subscribed by the
presenter on the CompositionTarget and keyed on GripperMode, so it keeps
ticking with every popup closed and ShowAt reopens on the way back in.

Nothing collapses the gripper now, so the visibility half of IsShowing and
the explicit re-show in ShowAt both go with it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
StartBringIntoView leaves the offset at 0 on some targets, so the
downward drag had nowhere to scroll and the test failed its own premise
rather than the behavior it guards - Assert.IsGreaterThan actual <0>
expected <200> on iOS Skia Runtime Tests 3, on both the run and the retry.

The old assertion (box pinned at the ScrollViewer's bottom edge) tolerated
a no-op scroll; the delta assertion does not.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 20, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229050 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageIconPage.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Buttons.png-dark
    • Buttons.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarToggleButtonTest.png
    • AppWindowFeatures.png-dark
    • ArcSegment.png
    • AutomationProperties_Name.png
    • BackGesture.png
    • BasicThemeResources.png
    • BitmapIcon_Generic.png-dark
    • BorderCenteredwithmargins.png
    • BorderTopwithmargins.png
    • BorderVersusPanelClipping.png-dark
    • Border_CornerRadius.png
    • Border_CornerRadius_Alignments.png-dark
    • Border_CornerRadius_Gradient.png-dark
    • Border_CornerRadius_Gradient.png
    • Border_LinearGradientBrush.png
    • Border_Simple.png-dark
    • Border_Simple_with_Opacity.png
    • Border_Simple_with_Uniform_Thickness.png-dark
    • Brushes_ImplicitConvert.png-dark
    • Brushes_ImplicitConvert.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Uno_Web.Http.CookieManagerTests
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/Uno.UI/UI/Xaml/Controls/Primitives/TextSelectionGripperPresenter.skia.cs:102

  • _frameLoop is declared as non-nullable but is used as a nullable field (checked against null and assigned null in UnsubscribeFromFrameLoop). This will produce nullable-reference warnings and is inconsistent with the intended lifetime semantics.
	private CompositionTarget _frameLoop;

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229354 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ClipboardTests.png-dark
    • ImageIconPage.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Focus_FocusVisual_Properties.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DisplayInformation.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowTitleBar Properties.png
    • AutoBorderStretchwithbottommargin.png
    • AutomationProperties_Name.png-dark
    • AutoSuggestBox_Description.png-dark
    • BasicAcrylicBrushTest.png-dark
    • Border_AntiAlias.png-dark
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • Border_With_CompositeTransform.png
    • Border_With_Off_Centre_RotateTransform.png-dark
    • Button_IsEnabled_Automated.png-dark
    • Button_IsEnabled_Automated.png
    • CenteredGridinGridwithtwofixedsizechildren.png-dark
    • CenteredGridinGridwithtwofixedsizechildren.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ComboBox_ComboBoxItem_Selection.png-dark
    • ComboBox_ComboBoxItem_Selection.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Uno_Web.Http.CookieManagerTests
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools

When_Touch_Focused_Then_Scrolled_Away_The_Scroll_Sticks failed on the iOS
and Android shards with a mute delta of 0. The cause was not the scroll
lock it guards, nor the geometry: it was the selection flyout the test's
own setup left open.

Measured across all three touch conventions on Skia Desktop, the single
discriminator is whether the SelectionFlyout is open. An open light-dismiss
flyout puts a window-filling hit-testable overlay above the whole tree
(FlyoutBasePopupPanel, transparent Background, IsViewHit => the popup's
IsLightDismissEnabled), so a press anywhere is consumed dismissing the
flyout rather than reaching the ScrollViewer - and the toolbar itself is
placed above the selection, overlapping the viewport, where a press goes to
its buttons instead. Both are correct behaviour; they just cost the gesture
this test needs. Once the flyout is gone the same drag scrolls the full 470
from either point.

The test's second tap is what opened it: on the mobile conventions that tap
word-selects and pops the flyout, where the Desktop convention leaves it
closed - which is why the desktop shards were green throughout.

One tap on a pinned Android convention reaches the state this test is
actually about: the insertion handle the removed clamp keyed on, no
selection, no flyout. The setup offset is bounded on both sides so the
geometry cannot drift into another mute failure, the premises are asserted
rather than left implicit, and the failure message carries the caret mode,
selection, flyout state and drag geometry - the touch conventions can only
be observed on CI, so each half has to say when it is the one that broke.

Pinned to SkiaDesktop | SkiaAndroid like every sibling in this cluster
(including the _iOS-suffixed one): the convention is pinned in code, so
running it on an iOS or WASM host only exercises a combination that never
ships.

Verified on Skia Desktop: passes; fails with Actual value <-30> when the
clamp's effect is injected before the assert, with every premise reporting
healthy; no regressions across Given_TextBox + Given_TextBlock (354 passed,
8 skipped, 1 pre-existing master failure in When_Inlines_Transitively_Change).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 22, 2026 08:02
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260819/textbox-scroll-lock-removal branch from aa31424 to 4e49157 Compare August 22, 2026 08:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229380 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ImageIconPage.png-dark
    • DisplayInformation.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ElementLevelTheme.png-dark
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AppBarButtonWithIconTest.png
    • ApplicationViewSpanningRectsPage.png-dark
    • Attributed_text_Supserscript.png-dark
    • AutoBorderStretchwithbottommargin.png-dark
    • AutomationProperties_Name.png
    • AutoSizedTopLeft.png-dark
    • AutoSuggestBox_SoftKeboard.png-dark
    • AutoSuggestBox_SoftKeboard.png
    • Basics Pivot Test.png
    • Basics_Automated.png
    • Battery.png-dark
    • BezierSegment.png-dark
    • BindableDrawerLayout_ChangePane.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • BorderBottomwithmargins.png
    • BorderVersusPanelClipping.png-dark
    • BorderLeftwithmargins.png
    • BorderVersusPanelClipping.png
    • BorderRightwithmargins.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 229050 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 229354 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 228809 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 228718 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 enabled auto-merge August 24, 2026 13:31
@Xiaoy312
Xiaoy312 merged commit a37fe6d into master Aug 24, 2026
53 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260819/textbox-scroll-lock-removal branch August 24, 2026 21:19
MartinZikmund added a commit that referenced this pull request Aug 25, 2026
The automation committed this sync with the conflicts unresolved. Master's
gripper-culling change (#24132) landed as modify/delete conflicts against the
partials this branch folded into their base files, and the automation resolved
them by restoring the deleted files.

- Fold master's ancestor-clipped GripperClipBounds into TextBlock.cs and
  TextBoxCore.Input.cs instead of resurrecting the .skia.cs partials.
- Drop ClampOffsetsToFocusedTextBox and ShouldSnapToTouchTextBox from
  ScrollViewer.cs, matching master's removal of the scroll lock.
- Retarget the incoming TextBox tests at TextBoxCore.CaretDisplayMode and
  TextBoxCore.TouchTextSelectionConvention, which is where this branch moved
  those nested types.
@ajpinedam

Copy link
Copy Markdown
Contributor

@Mergifyio backport release/stable/6.7

@mergify

mergify Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.7

✅ Backports have been created

Details

kazo0 added a commit that referenced this pull request Aug 28, 2026
…6.7/pr-24132

fix: Cull text grippers instead of locking scroll (backport #24132)
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.

5 participants