Repository navigation
Description
Current behavior 🐛
On Skia, the text SelectionFlyout (the touch Copy / Paste / Select-all bar) is positioned once, at show time, and nothing repositions or hides it afterwards. When the text it belongs to scrolls out of view, the flyout stays parked at its original screen position, floating over whatever is painted there.
TextBox.UpdateSelectionFlyoutVisibility (src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs) computes a position from the current selection and calls TextControlFlyoutHelper.ShowAt(selectionFlyout, this, position, FlyoutShowMode.Transient). After that, the flyout takes no part in any per-frame or scroll-driven update: FlyoutBase has no ViewChanged / scroll hook, and the only dismissal path on the touch route is DismissSelectionFlyoutForPointerPress, driven by a pointer press on the TextBox itself (TextBox.pointers.skia.cs).
So the common gesture — grabbing the text and dragging to scroll — does dismiss it, because the drag starts with a press on the TextBox. The flyout is left stranded whenever the scroll happens without a press on the text:
- mouse wheel or trackpad scroll
- dragging the scrollbar
- keyboard scrolling (Page Down and friends)
- programmatic
ChangeView/ScrollIntoView/StartBringIntoView - a touch drag begun outside the TextBox
- an outer
ScrollViewerscrolled while the flyout belongs to a TextBox in an inner one
The touch selection grippers were given exactly this treatment in #24132 — they reposition once per rendered frame and are culled against the host's effective ancestor clip — which leaves the SelectionFlyout as the one touch-selection affordance that still floats free of its anchor.
Expected behavior 🎯
The flyout should not stay over unrelated content once its anchor text is no longer visible: it should either track the selection while the selection is on screen, or be dismissed when the selection is clipped away.
Which of the two matches the reference is worth confirming against native WinUI (/winui-runtime-tests) and against native iOS/Android before implementing — the Uno touch flyout deliberately follows the native mobile convention in places (it pops over a collapsed caret, which WinUI does not), so "what should happen on scroll" is not obviously the same answer on both.
How to reproduce it (as minimally and precisely as possible) 🔬
On a Skia head (Desktop is enough):
- Put a multi-line
TextBox(tall enough to overflow) inside aScrollViewershorter than it, with filler content above and below. - Touch-select a word in the TextBox so the
SelectionFlyoutappears. - Scroll the
ScrollViewerwithout touching the TextBox — mouse wheel over the filler, orsv.ChangeView(null, <offset>, null)from code — until the TextBox is fully outside the viewport.
The flyout stays where it was, over the filler content.
Workaround 🛠️
Set TextBox.SelectionFlyout to null to opt out of the flyout entirely. There is no app-side way to keep it and have it track the selection.
Renderer 🎨
- Skia
- Native
Affected platforms 📱💻🖥️
All Skia targets (Desktop Windows/macOS/X11, WebAssembly, Skia-on-Android/iOS). Touch-driven, so most visible on the mobile Skia heads and on touch-screen desktops.
Uno.Sdk version (and other relevant versions) 📦
dev branch, at the time of writing (10f8e3e69f).
Anything else we need to know? 💬
Established by code inspection of the show/dismiss paths above, not by a runtime repro — worth reproducing before scoping the fix.
Possible approach: the plumbing the grippers use is already in place and host-agnostic. ITextSelectionGripperHost.GripperClipBounds returns the host's ancestor-clipped global bounds, and TextSelectionGripperPresenter.Update already runs once per rendered frame while a touch selection is up — so the flyout could ride the same pass rather than growing a second mechanism. Note that a selectable TextBlock shares that host interface, so whatever is done should cover both hosts.
Activity