Skip to content

feat(toolkit): Add opt-in touch scrollbar thumb drag (backport #24199) - #24331

Merged
agneszitte merged 18 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24199
Sep 11, 2026
Merged

agneszitte merged 18 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24199

Conversation

@mergify

@mergify mergify Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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 ScrollViewer and in CommunityToolkit DataGrid.

This turned out to be intended WinUI behaviour, not a bug. dxaml\xcp\dxaml\lib\ScrollBar_Partial.cpp (AttachEvents, tag winui3/release/1.6.5) calls put_IgnoreTouchInput(TRUE) on both thumbs and all eight repeat buttons — ten parts, which Uno ports one-for-one — and Thumb::put_IgnoreTouchInput exists solely for that purpose, defaulting to FALSE with ScrollBar as its only caller. WinUI also drives TouchIndicator deliberately. 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.Toolkit attached property:

<Style TargetType="ScrollBar">
  <Setter Property="toolkit:ScrollBarExtensions.IsTouchThumbDragEnabled" Value="True" />
</Style>

Applied through an implicit Style as above it also covers scrollbars an app cannot reach directly, including DataGrid'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 IgnoreTouchInput and by pinning IndicatorMode. iPad validation showed that approach is not sound, for two reasons:

  1. ScrollBar.AttachEvents re-applies IgnoreTouchInput = true to its parts every time it attaches them — on template application and on Loaded — so anything set from outside is undone. The ScrollViewer template also defers its bars (x:Load="False"), so with Auto visibility a bar is realized only once an axis overflows, after any external code has run.
  2. IndicatorMode is driven by the ScrollViewer's visual states, i.e. at animation precedence, so a local value set from the Toolkit loses. After any finger pan the bar returned to TouchIndicator, 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:

  • AttachEvents applies IgnoreTouchInput = !IsTouchThumbDragEnabled to the ten parts instead of a hard-coded true — 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

  • Runtime — Skia Desktop (SamplesApp.Skia.Generic), Given_ScrollBar: 10 passed / 0 skipped.
    • Touch thumb drag for both orientations, asserting Value plus the ThumbTrack and EndScroll sequence.
    • Both a standalone ScrollBar (the DataGrid shape) and a ScrollViewer-hosted one, the latter across Visible and Auto bar visibility — Auto matters because the template defers those bars.
    • When_Touch_Panned_Then_Thumb_Is_Still_Draggable pans with a finger first, asserts the bar really reached TouchIndicator, and only then drags the thumb, so it cannot pass without entering the state that broke on device.
    • When_Reloaded_Then_Touch_Thumb_Drag_Survives covers the re-attach path from (1) above.
    • When_Touch_Drags_Thumb_Without_OptIn_Then_Value_Is_Unchanged pins the default behaviour: without opting in, a touch drag must not move the bar.
    • Fails-before/passes-after: with the core change neutered, 8 of those 10 fail — while the default-behaviour test still passes, which is the evidence the change is genuinely gated.
  • Device — validated on a physical iPad (iPadOS Safari, Skia WebAssembly) with the added manual sample ScrollViewer_TouchScrollBarDrag (category Scrolling), which has an in-page toggle for the opt-in so both states can be compared without a rebuild.
  • Compile — 0 errors.

PR Checklist ✅


This is an automatic backport of pull request #24199 done by [Mergify](https://mergify.com).

@github-actions github-actions Bot added area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels Sep 1, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@ajpinedam

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@mergify

mergify Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@agneszitte
agneszitte merged commit af9f66d into release/stable/6.7 Sep 11, 2026
50 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-24199 branch September 11, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants