Skip to content

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

Merged
ajpinedam merged 16 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-25531
Oct 29, 2026
Merged

ajpinedam merged 16 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-25531

Conversation

@mergify

@mergify mergify Bot commented Oct 28, 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).

@mergify mergify Bot added the conflicts Automated merge hit conflicts label Oct 28, 2026
@mergify

mergify Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of 3e11bd3 has failed:

On branch mergify/bp/servicing/6.8/pr-25531
Your branch is up to date with 'origin/servicing/6.8'.

You are currently cherry-picking commit 3e11bd3.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   src/Uno.UI.RuntimeTests/Helpers/InjectedPointerHoldExtensions.cs
	modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.cs
	modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Button.cs
	modified:   src/Uno.UI.UnitTests/Windows_UI_Input/Given_GestureRecognizer.cs
	modified:   src/Uno.UI/UI/Xaml/UIElement.Pointers.cs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/Uno.UI/UI/Input/WinRT/GestureRecognizer.Gesture.cs
	both modified:   src/Uno.UI/UI/Input/WinRT/GestureRecognizer.cs

Cherry-pick of 93cb47c has failed:

On branch mergify/bp/servicing/6.8/pr-25531
Your branch is ahead of 'origin/servicing/6.8' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 93cb47c.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ListViewBase.cs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	added by them:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ListBox.cs
	both modified:   src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.cs

Cherry-pick of bfdb0b8 has failed:

On branch mergify/bp/servicing/6.8/pr-25531
Your branch is ahead of 'origin/servicing/6.8' by 3 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit bfdb0b8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	added by them:   src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ListView/ListView_TouchHold.xaml
	added by them:   src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/ListView/ListView_TouchHold.xaml.cs

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of b037cad has failed:

On branch mergify/bp/servicing/6.8/pr-25531
Your branch is ahead of 'origin/servicing/6.8' by 7 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit b037cad.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ListViewBase.cs
	modified:   src/Uno.UI/UI/Input/WinRT/GestureRecognizer.cs
	modified:   src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.cs
	modified:   src/Uno.UI/UI/Xaml/UIElement.Pointers.cs
	modified:   src/Uno.UWP/FeatureConfiguration/WinRTFeatureConfiguration.GestureRecognizer.cs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   doc/articles/feature-flags.md

Cherry-pick of b1c3e82 has failed:

On branch mergify/bp/servicing/6.8/pr-25531
Your branch is ahead of 'origin/servicing/6.8' by 10 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit b1c3e82.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.cs

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

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

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 241953 has failed on Uno.UI - docs.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 241952 has failed on Uno.UI - CI.

@ajpinedam

Copy link
Copy Markdown
Contributor

Resolved the cherry-pick conflicts Mergify committed, in one commit on top (06809b3). Mergify's commits are untouched.

The conflicts came from master-only changes next to this PR's edits:

  • GestureRecognizer.cs: dropped ReportsUnquantizedDeltas. It comes from perf(scrollviewer): Drive fling and wheel motion per frame #24739 (master only) and was pulled in by the conflict block.
  • GestureRecognizer.Gesture.cs: kept 6.8's PointerPoint signature (master's global::Microsoft.UI.Input.PointerPoint comes from Dev/bc public api phase4 #23619) with this PR's new IsLongPress body.
  • SelectorItem.cs: kept 6.8's usings. The PR's own using changes cancel out, and 6.8 already has Uno.Foundation.Logging.
  • feature-flags.md: put the "Gestures" section before "Popups" (6.8 has no "Input validation" section) and restored the "Allow popup under translucent status bar" heading.

Two more fixes for names that only exist on master and that git couldn't flag:

  • Uno.UI.DevTools.Input → Uno.UI.Toolkit.DevTools.Input in InjectedPointerHoldExtensions.cs and Given_ListBox.cs.
  • Added master's GetAbsoluteCenter() test helper to UITestHelper.cs, so the backported tests stay identical to master.

Every other file matches the master PR's diff, at its 6.8 path.

Local validation (macOS):

  • Compile: Uno.UI.RuntimeTests.Skia (net10.0, so Uno.UI Skia too) and Uno.UI.UnitTests build clean.
  • Runtime: Given_GestureRecognizer unit tests pass, 71/71, including the new hold tests.
  • markdownlint passes on feature-flags.md.
  • The runtime tests were not run locally; CI will run them.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 242039 has failed on Uno.UI - CI.

(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 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 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 b037cad)

# Conflicts:
#	doc/articles/feature-flags.md
(cherry picked from commit b1c3e82)

# Conflicts:
#	src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.cs
@ajpinedam
ajpinedam force-pushed the mergify/bp/servicing/6.8/pr-25531 branch from 06809b3 to 26a6237 Compare October 28, 2026 23:42
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 242096 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

@mergify

mergify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@ajpinedam
ajpinedam merged commit dec7b5e into servicing/6.8 Oct 29, 2026
45 checks passed
@ajpinedam
ajpinedam deleted the mergify/bp/servicing/6.8/pr-25531 branch October 29, 2026 20:28
@agneszitte

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/6.7

@mergify

mergify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

backport release/stable/6.7

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request Nov 3, 2026
…6.7/pr-25790

fix(input): Prevent touch holds from raising taps and item clicks (backport #25531) (backport #25790)
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 conflicts Automated merge hit conflicts kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants