Repository navigation
Conversation
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
|
@ajpinedam is it possible to touch drag the bar on WinUI? I think that it may actually just be intended this way. I think it may be possible to confirm via WinUI C++ sources, but if it would be Uno specific, it would be better as some extension in Uno Toolkit or such |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
|
You're right, and it's confirmed in the WinUI sources.
The gap is still real on touch-only targets — a browser on a tablet has no mouse, so the scrollbar is the only affordance, and there's no WinUI equivalent — but that makes this an enhancement, not a fix, and it shouldn't change default behavior on every target. So I'll take your suggestion: moving it out of core into an opt-in |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
There was a problem hiding this comment.
Pull request overview
This PR introduces an opt-in Uno.UI.Toolkit attached property to enable touch (finger) dragging of ScrollBar thumbs on touch-only scenarios (notably iOS/iPadOS WebAssembly), while keeping default WinUI parity unchanged.
Changes:
- Add
ScrollBarExtensions.IsTouchThumbDragEnabled(Toolkit) and a corresponding internal flag onScrollBarto reconfigure template-part touch behavior. - Update
ScrollBarinternals to honor the opt-in by keeping interactive visual states and by togglingIgnoreTouchInputon relevant template parts. - Add runtime tests + a SamplesApp manual test page, and document the feature in
Uno.UI.Toolkit.md.
Review verdict (summary): changes needed.
Issue counts: 1 documentation/build-risk issue, 1 test-hygiene issue.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Controls/ScrollBar/ScrollBar.uno.cs | Adds internal opt-in flag/property and triggers re-attach + visual refresh when toggled. |
| src/Uno.UI/UI/Xaml/Controls/ScrollBar/ScrollBar.mux.cs | Applies opt-in by toggling IgnoreTouchInput for thumbs/repeat buttons during event attachment. |
| src/Uno.UI/UI/Xaml/Controls/ScrollBar/ScrollBar.h.mux.cs | Treats opt-in scrollbars as “not conscious” to keep interactive indicator visible. |
| src/Uno.UI.Toolkit/ScrollBarExtensions.cs | Introduces attached property API and (Uno-only) change callback wiring into ScrollBar. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls_Primitives/Given_ScrollBar.cs | Adds runtime tests validating opt-in behavior and default behavior; includes one ignored test documenting a limitation. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_TouchScrollBarDrag.xaml.cs | Adds manual test logic to toggle opt-in and report scrollbar state/events. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_TouchScrollBarDrag.xaml | Adds manual test UI to exercise touch thumb dragging (ScrollViewer + standalone ScrollBar). |
| doc/articles/Uno.UI.Toolkit.md | Documents the new opt-in property and usage patterns (including implicit Style). |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24199/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls_Primitives/Given_ScrollBar.cs:4
System.LinqandSystem.Textare not used anywhere in this test file. With analyzer enforcement, unused usings can break CI (IDE0005 / CS0105). Remove them to keep the test project warning-clean.
This issue also appears on line 17 of the same file.
using System.Linq;
using System.Text;
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls_Primitives/Given_ScrollBar.cs:17
Windows.UI.Input.Preview.Injectionis not referenced in this file (the tests useUno.UI.Toolkit.DevTools.Input.InputInjectorinstead). Remove the unused using to avoid analyzer failures.
using Windows.UI.Input.Preview.Injection;
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24199/docs/index.html |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 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/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_TouchScrollBarDrag.xaml.cs:45
LayoutUpdatedcan fire very frequently (including while scrolling). CallingTryResolveScrollBars()on everyLayoutUpdatedcauses repeated visual-tree walks and status updates, which can noticeably slow down this manual sample. Consider gating the call so you only search when a bar is missing and the correspondingComputed*ScrollBarVisibilityindicates it should be visible (overflow), or otherwise stop polling once resolved.
// The ScrollViewer template defers its bars (x:Load="False"), so with Auto visibility they only appear
// once an axis actually overflows - after this page has loaded. Keep looking until they show up.
private void OnViewportLayoutUpdated(object sender, object e) => TryResolveScrollBars();
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24199/docs/index.html |
|
|
58763cc to
1dd1009
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24199/docs/index.html |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls_Primitives/Given_ScrollBar.cs:126
- This test can pass even if the injected touch never actually hits a laid-out thumb (e.g., if the template is present but the thumb has 0×0 bounds). Adding a bounds assert here makes the “default behavior unchanged” coverage more reliable and avoids false positives.
var thumb = FindTemplateChild<Thumb>(SUT, "VerticalThumb");
Assert.IsNotNull(thumb, "The vertical thumb should be part of the ScrollBar template.");
finger.Press(Center(thumb.GetAbsoluteBounds()));
finger.MoveBy(0, 50, steps: 50);
src/Uno.UI.Toolkit/ScrollBarExtensions.cs:19
- The remark says “No effect on Windows”, but this opt-in does take effect on Uno’s managed (Skia) desktop targets which can run on Windows OS. Consider clarifying that the no-op case is WinAppSDK/native WinUI, not the Windows OS in general.
/// WinUI has the ScrollBar parts ignore touch, as touch scrolling goes through DirectManipulation
/// there and the bar is only an indicator. A touch-only device - a browser on a tablet most notably -
/// has no pointer to reveal an interactive bar with, so this opts into keeping the bar in its
/// interactive state, which also keeps it visible. No effect on Windows.
/// </remarks>
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24199/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24199/docs/index.html |
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
|
…6.7/pr-24199 feat(toolkit): Add opt-in touch scrollbar thumb drag (backport #24199)
GitHub Issue: Tracked internally (customer-reported). No public issue.
PR Type:
✨ Feature
What changed? 🚀
A customer reported that on iOS/iPadOS WebAssembly, touching a scrollbar reveals it but dragging the thumb does not scroll — in a plain
ScrollViewerand in CommunityToolkitDataGrid.This turned out to be intended WinUI behaviour, not a bug.
dxaml\xcp\dxaml\lib\ScrollBar_Partial.cpp(AttachEvents, tagwinui3/release/1.6.5) callsput_IgnoreTouchInput(TRUE)on both thumbs and all eight repeat buttons — ten parts, which Uno ports one-for-one — andThumb::put_IgnoreTouchInputexists solely for that purpose, defaulting toFALSEwithScrollBaras its only caller. WinUI also drivesTouchIndicatordeliberately. So a touch drag on a scrollbar thumb is not possible on WinUI by design.The gap is nonetheless real on touch-only targets: a browser on a tablet has no mouse, so the scrollbar is the only affordance and WinUI's assumption does not hold. That makes this an enhancement, which must not change default behaviour on any target.
It ships as an opt-in
Uno.UI.Toolkitattached property:Applied through an implicit
Styleas above it also covers scrollbars an app cannot reach directly, includingDataGrid's internal bars.This does change core code, behind the opt-in
An earlier revision tried to do this entirely from the Toolkit, by walking the template to clear
IgnoreTouchInputand by pinningIndicatorMode. iPad validation showed that approach is not sound, for two reasons:ScrollBar.AttachEventsre-appliesIgnoreTouchInput = trueto its parts every time it attaches them — on template application and onLoaded— so anything set from outside is undone. TheScrollViewertemplate also defers its bars (x:Load="False"), so withAutovisibility a bar is realized only once an axis overflows, after any external code has run.IndicatorModeis driven by theScrollViewer's visual states, i.e. at animation precedence, so a local value set from the Toolkit loses. After any finger pan the bar returned toTouchIndicator, where the template collapses the interactive root the thumb lives in.So the opt-in is now a per-instance internal flag on
ScrollBar, honoured in the two places that decide this, both gated:AttachEventsappliesIgnoreTouchInput = !IsTouchThumbDragEnabledto the ten parts instead of a hard-codedtrue— the exact line WinUI hard-codes.IsConscious()becomes per-instance (ShouldUseDynamicScrollbars() && !IsTouchThumbDragEnabled), so an opted-in bar takes the same path WinUI takes when the OS "automatically hide scroll bars" setting is off: it keeps the interactive indicator instead of the thin touch one.Default behaviour is unchanged on every target, which is pinned by a test (below). The Toolkit extension is now ~45 lines that set that flag, with no visual-tree walking and no timing assumptions.
Known limitation
While enabled the bar stays visible and interactive, so a pan started on the scrollbar drags the thumb rather than panning the content — the same as any pointer-driven scrollbar. Documented in
doc/articles/Uno.UI.Toolkit.md.Validation
SamplesApp.Skia.Generic),Given_ScrollBar: 10 passed / 0 skipped.Valueplus theThumbTrackandEndScrollsequence.ScrollBar(theDataGridshape) and aScrollViewer-hosted one, the latter acrossVisibleandAutobar visibility —Automatters because the template defers those bars.When_Touch_Panned_Then_Thumb_Is_Still_Draggablepans with a finger first, asserts the bar really reachedTouchIndicator, and only then drags the thumb, so it cannot pass without entering the state that broke on device.When_Reloaded_Then_Touch_Thumb_Drag_Survivescovers the re-attach path from (1) above.When_Touch_Drags_Thumb_Without_OptIn_Then_Value_Is_Unchangedpins the default behaviour: without opting in, a touch drag must not move the bar.ScrollViewer_TouchScrollBarDrag(category Scrolling), which has an in-page toggle for the opt-in so both states can be compared without a rebuild.PR Checklist ✅
Screenshots Compare Test Runresults.