Repository navigation
feat(toolkit): Add opt-in touch scrollbar thumb drag (backport #24199) - #24331
Merged
agneszitte merged 18 commits intoSep 11, 2026
Merged
Conversation
(cherry picked from commit 619f5c9)
(cherry picked from commit 3e2cc19)
(cherry picked from commit 6ae0927)
(cherry picked from commit c88f65e)
(cherry picked from commit 4901383)
(cherry picked from commit 8e02337)
(cherry picked from commit d853cfc)
(cherry picked from commit c2c6281)
(cherry picked from commit cdc1678)
(cherry picked from commit 7f076cb)
(cherry picked from commit 39830a6)
(cherry picked from commit d5e7ef6)
(cherry picked from commit 25b8d8f)
(cherry picked from commit e275d3f)
(cherry picked from commit 3adc4fa)
(cherry picked from commit 1dd1009)
(cherry picked from commit 53a6941)
(cherry picked from commit 18fd4d4)
ajpinedam
approved these changes
Sep 1, 2026
4 of 5 tasks
Contributor
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24331/docs/index.html |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24331/wasm-skia-net9/index.html |
Contributor
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24331/docs/index.html |
Contributor
Author
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.This is an automatic backport of pull request #24199 done by [Mergify](https://mergify.com).