Skip to content

fix(input): Prevent touch holds from raising taps and item clicks (backport #25531) (backport #25790) - #25956

Merged
agneszitte merged 16 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25790
Nov 3, 2026
Merged

agneszitte merged 16 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25790

Conversation

@mergify

@mergify mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes unoplatform/kahua-private#550

PR Type:

🐞 Bugfix

What changed? 🚀

On Skia, as seen in iPad Safari on WebAssembly, long-pressing a clickable ListView/GridView item opens its context menu, and releasing the finger then also raises Tapped/ItemClick and selects the item. Long-pressing blank app space also selects the host. There were three causes. A UIElement's GestureRecognizer reported a touch or pen hold as a tap whenever RightTap wasn't enabled, and that hold could also start a DoubleTapped. It also missed holds where the holding timer fired before the pointer timestamps reached 800 ms. Separately, SelectorItem raised ItemClick and changed the selection on every release, while WinUI's ListViewBaseItem runs its tap interaction only when a Tapped follows, and a touch or pen hold is a right-tap. With this PR, UIElement recognizers set SuppressesTapOnHold: a touch or pen hold (Holding was raised, or the press lasted longer than HoldMinDelayMicroseconds) is never a tap or the first tap of a double-tap, and right-tap detection uses the same check. A ListViewBaseItem skips ItemClick and selection on a touch or pen hold, while ListBoxItem and ComboBoxItem still select on a hold, as on WinUI. uno.css turns off selection and the touch callout on #uno-root/#uno-body, but keeps them for hosted HTML and editable elements. Runtime tests cover holds on UIElement, Button, ListView/GridView (touch and pen), ListBox and GestureRecognizer, and a ListView_TouchHold sample was added. The 7 touch cases that compile for WinUI also pass against native WinUI. Running them there needed two test-side fixes, both included here: a PointerDeviceType alias for WinAppSDK (3b42ad6d3e) and update frames during injected WinUI holds (ccdfa80948). The tests added in review haven't been run against WinUI yet.

Review follow-ups: only the release of the pointer that armed an item click can raise it, so a second finger's hold no longer raises ItemClick. Every UIElement recognizer now treats a press as a hold once any of them raised Holding for it. A parent with a ContextFlyout no longer lets a Tapped-only child raise Tapped for that press. Implementing GestureFollowing is tracked in #25673.

Behavior change ⚠️

This aligns Uno with WinUI, but apps may notice it. On every Skia target, a touch or pen hold no longer raises Tapped or DoubleTapped, and a ListView/GridView item no longer raises ItemClick or changes the selection when a hold ends. On WebAssembly, long-pressing the app no longer selects it or opens the touch callout (hosted HTML and editable elements keep both). To report holds as taps again, apps can set Uno.WinRTFeatureConfiguration.GestureRecognizer.SuppressTapOnHold = false at startup. That restores Tapped, ItemClick and selection on holds, but not the WebAssembly CSS. It's documented in doc/articles/feature-flags.md.

PR Checklist ✅


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

(cherry picked from commit 3e11bd3)

# Conflicts:
#	src/Uno.UI/UI/Input/WinRT/GestureRecognizer.Gesture.cs
#	src/Uno.UI/UI/Input/WinRT/GestureRecognizer.cs
(cherry picked from commit f95c91b)
(cherry picked from commit 93cb47c)

# Conflicts:
#	src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ListBox.cs
#	src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.cs
(cherry picked from commit 32cfa9f)
(cherry picked from commit a5c73af)
(cherry picked from commit 8913e9f)
(cherry picked from commit bfdb0b8)

# Conflicts:
#	src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ListView/ListView_TouchHold.xaml
#	src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ListView/ListView_TouchHold.xaml.cs
(cherry picked from commit b8c08f2)
(cherry picked from commit 2dc7455)
(cherry picked from commit 71d0cc5)
(cherry picked from commit a1f8017)
(cherry picked from commit 2260f83)
(cherry picked from commit 3c628e6)
(cherry picked from commit d822fe8)
(cherry picked from commit b037cad)

# Conflicts:
#	doc/articles/feature-flags.md
(cherry picked from commit 5195dde)
(cherry picked from commit 3642922)
(cherry picked from commit 66abf9f)
(cherry picked from commit c06c980)
(cherry picked from commit 53bfd05)
(cherry picked from commit b1c3e82)

# Conflicts:
#	src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.cs
(cherry picked from commit b02b6cf)
(cherry picked from commit 5dcdb03)
(cherry picked from commit eaa1204)
(cherry picked from commit 052cdb2)
(cherry picked from commit a5a6157)
(cherry picked from commit 8b5b150)
(cherry picked from commit 7819d65)
@github-actions github-actions Bot added area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels Nov 3, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@agneszitte
agneszitte merged commit 459d4d8 into release/stable/6.7 Nov 3, 2026
42 of 49 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-25790 branch November 3, 2026 05:14
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