From 8739939e75631dc8fd0e8f59c03086fccd5ff278 Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Mon, 29 Jun 2026 10:00:03 +0200 Subject: [PATCH 1/2] fix: Cancel click on touch long-press menu On Skia targets, long-pressing a control (e.g. a Button) with a ContextFlyout both opened the menu AND raised Click, instead of behaving like a right-tap. WinUI suppresses the click because opening the menu's popup steals the OS pointer capture (PointerCaptureLost); Uno's in-canvas popups don't, so the pressed state was never cleared. When a context menu is shown on a touch press-and-hold, release the pressing element's pointer capture and raise an unhandled PointerCaptureLost so the control clears its pressed state and does not click on release. fixes #22229 Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01WQEkhvePgnJMns2KhVNUxr --- .../Given_ContextRequested.Injection.cs | 109 ++++++++++++++++++ .../UI/Xaml/Internal/ContextMenuProcessor.cs | 35 ++++++ src/Uno.UI/UI/Xaml/UIElement.Pointers.cs | 30 +++++ 3 files changed, 174 insertions(+) diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_ContextRequested.Injection.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_ContextRequested.Injection.cs index c75bb2dbed4c..7678fd6dc2d2 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_ContextRequested.Injection.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_ContextRequested.Injection.cs @@ -375,5 +375,114 @@ public async Task When_RightClick_OriginalSource_Is_Correct() Assert.IsTrue(innerButton.Equals(capturedOriginalSource) || VisualTreeUtils.FindVisualParentByType