Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores Skia scrolling parity by removing the “snap back to touch-focused TextBox” clamping behavior in ScrollViewer, and instead fixing the underlying cause of selection grippers floating over unrelated content when their anchor is scrolled out of view (by culling grippers against effective visible bounds and keeping their position updates active).
Changes:
- Update
TextBox/selectableTextBlockgripper culling to use effective visible bounds (GetGlobalBoundsWithOptionswith clipping applied). - Keep grippers tracking their anchors via a
CompositionTarget.FrameRenderedsubscription so culled grippers can reappear when scrolled back into view. - Remove Skia-specific ScrollViewer clamp/snap-to-touch-textbox logic and update/add Skia runtime tests to validate the new behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs | Uses clipped global bounds for gripper culling on Skia. |
| src/Uno.UI/UI/Xaml/Controls/TextBlock/TextBlock.skia.cs | Uses clipped global bounds for gripper culling on Skia selectable TextBlock. |
| src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.SnapPoints.cs | Removes Skia clamp call and ShouldSnapToTouchTextBox partial. |
| src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.skia.cs | Removes Skia-only clamp/snap implementation. |
| src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs | Stops arming snap-point tracking based on touch TextBox focus. |
| src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.Managed.cs | Removes inertia snapping behavior that was solely for the touch TextBox clamp. |
| src/Uno.UI/UI/Xaml/Controls/Primitives/TextSelectionGripperPresenter.skia.cs | Drives grippers via per-frame updates for correct repositioning/culling while scrolling. |
| src/Uno.UI/UI/Xaml/Controls/Primitives/CaretWithStemAndThumb.skia.cs | Simplifies gripper popup lifecycle; adds test hook for popup open state. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs | Updates existing test expectations and adds coverage for “scroll away does not snap back”. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| // Subscribed while the grippers are active (GripperMode != Hidden) so they keep tracking their | ||
| // anchors every rendered frame (scrolling, text moves), even while culled out of view or after | ||
| // their popup was closed externally. Same pattern as SystemFocusVisual. | ||
| private CompositionTarget _frameRenderedTarget; | ||
|
|
| return; | ||
| } | ||
|
|
||
| EnsureFrameRenderedSubscription(); |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24099/wasm-skia-net9/index.html |
|
The build 228335 found UI Test snapshots differences: Details
|
GitHub Issue: tracked internally (customer report)
PR Type:
🐞 Bugfix
What changed? 🚀
On Skia targets, once a
TextBoxwas focused via touch (insertion handle or selection grippers showing), the parentScrollViewerrefused to let the user scroll it out of view: any scroll away from the field stopped and animated back until the TextBox was in the viewport again. On a form with many fields (customer repro), selecting text in a field near the bottom made it impossible to scroll back up.This "keep the touch TextBox in view" clamp (
ScrollViewer.ShouldSnapToTouchTextBox/ClampOffsetsToFocusedTextBox, introduced in #20155) existed to work around the selection grippers floating over unrelated content (e.g. the OS navigation bar) when their anchor was scrolled out of view, since the gripper popups were only culled against the TextBox's own (unclipped) bounds.This PR fixes the root cause of that original artifact and removes the clamp, restoring native/WinUI scrolling parity:
GripperClipBounds(TextBox + selectable TextBlock) now returns the control's effective visible bounds (GetGlobalBoundsWithOptions, ancestor clips + window viewport applied) instead of its unclipped absolute bounds, so grippers are culled as soon as their anchor leaves a parentScrollViewer's viewport (or the window) — they no longer float over unrelated content.ShouldSnapToTouchTextBox/ClampOffsetsToFocusedTextBoxand their call sites (snap-points adjustment, snap timer arming, direct-manipulation inertia handling). The user can now freely scroll a focused touch TextBox out of view.When_Touch_Focused_Then_Scrolled_Awaywas updated to assert the new expectations (scroll offset preserved, grippers culled while out of view, grippers re-shown when brought back), and a newWhen_Touch_TextBox_In_ScrollViewer_Scroll_Away_Does_Not_Snap_Backtest covers the customer scenario (Android touch convention, insertion-handle and selection variants).Note: when the selection toolbar (
TextCommandBarFlyout) is open, the first swipe is still consumed by its light-dismiss layer (dismisses the toolbar without scrolling); WinUI's transient flyouts pass that input through. That is a separate popup-infrastructure gap, out of scope here.PR Checklist ✅
Screenshots Compare Test Runresults.