Repository navigation
fix: cancel parent direct manipulations after press bubble completes - #23135
ramezgerges merged 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts managed direct-manipulation cancellation timing so parent direct manipulations (e.g., ScrollViewer) are cancelled only after the PointerPressed bubble completes, preventing premature completion/redirect during nested manipulation scenarios.
Changes:
- Remove early
CancelDirectManipulations()call fromUIElement.OnPointerDown. - Add post-bubble cancellation in
AfterPressForDirectManipulationfor non-SystemUIElement manipulation recognizers. - Add a runtime test that reproduces/guards the pinch-inside-ScrollViewer regression.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/UIElement.Pointers.cs | Stops cancelling parent direct manipulations during OnPointerDown bubbling. |
| src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.ManagedDirectManip.cs | Cancels parent direct manipulations after press bubbling completes; exposes UIElement from UIElementRecognizer for the new logic. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.Manipulations.cs | Adds regression test for pinch/scale within a ScrollViewer to ensure manipulations don’t complete mid-gesture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23135/wasm-skia-net9/index.html |
327789e to
aee5de2
Compare
aee5de2 to
a2a4a9a
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts Uno’s pointer/manipulation routing so that when a non-System ManipulationMode UIElement participates in a press bubble, ancestor direct manipulations (e.g., ScrollViewer/ScrollContentPresenter DM) are cancelled/avoided to prevent mid-gesture pointer hijacking (notably during pinch/scale inside scrollable content).
Changes:
- Cancel ancestor direct manipulations on
UIElement.OnPointerDownwhenManipulationModeis non-System. - Prevent registering a parent direct manipulation handler if an in-bubble UIElement recognizer should block it (new
BlocksDirectManipulationForhook). - Add a runtime regression test covering pinch/scale inside a
ScrollViewerto ensureManipulationCompleteddoesn’t fire mid-gesture andManipulationDeltacontinues through the gesture.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Uno.UI/UI/Xaml/UIElement.Pointers.cs |
Cancels parent direct manipulations on pointer down for non-System manipulation elements. |
src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.ManagedDirectManip.cs |
Adds blocking check to avoid creating ancestor direct manipulations when a descendant manipulation recognizer has claimed the gesture. |
src/Uno.UI/UI/Xaml/Internal/DirectManipulation.cs |
Implements the new interface method (BlocksDirectManipulationFor) for direct manipulation recognizers (no blocking). |
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.Manipulations.cs |
Adds an input-injection regression test reproducing and guarding the pinch-vs-scroll DM interaction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23135/wasm-skia-net9/index.html |
…settles When a UIElement has ManipulationMode != System it has already declared "I'm handling this manipulation"; UIElement.OnPointerDown calls CancelDirectManipulations() to drop ancestor DMs. That call walks the DM list at the moment OnPointerDown runs — which during managed bubbling (ctx=OnManagedBubbling) is BEFORE higher ancestors like ScrollContentPresenter have had a chance to register their DMs via TryEnableDirectManipulation. The later-registered ancestor DM survives, tracks the pointer, and on the next move fires OnDirectManipulationStarted → CancelPointer, aborting the descendant's manipulation. On Skia Android, a pinch on a ManipulationMode=Scale Grid inside a scrollable ScrollViewer would fire ManipulationCompleted mid-gesture for exactly this reason. Track the first requester in InputManager.PointerManager.CancelDirectManipulations in a per-press field, reset in BeforePressTryRedirectToManipulations and consumed in AfterPressForDirectManipulation by re-running the cancel walk for that element. Because everything goes through InputManager.PointerManager.CancelDirectManipulations, this also covers end-user calls to UIElement.CancelDirectManipulations(): if app code cancels DMs from a custom PointerPressed handler before the bubble has reached the ScrollContentPresenter, the after-bubble redo catches the late registration.
a2a4a9a to
567b140
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23135/wasm-skia-net9/index.html |
Add When_PinchOnScaleGrid_InsideScrollViewer_Then_ManipulationDoesNotCompletePrematurely. Reproduces the prior bug where a two-finger pinch on a ManipulationMode=Scale Grid inside a scrollable ScrollViewer would fire ManipulationCompleted mid-gesture because ScrollContentPresenter's DirectManipulation stole the second pointer. Two requirements to actually trigger the bug: * Content must be bigger than the viewport (600x600 Grid inside a 300x300 ScrollViewer) so the SCP DM doesn't abort immediately for lack of scrollable space. * The pressed element must be a child of the Scale grid (a 300x300 Rectangle pinned to the top-left) so the grid is an intermediate element in the bubble — the managed-bubbling path which ran the broken cancel timing. Fingers fan outward with asymmetric Y drift so the SCP DM's TranslateY threshold (15 px on touch) is crossed partway through, exactly matching the device-level repro.
567b140 to
f347111
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23135/wasm-skia-net9/index.html |
|
|
|
@Mergifyio backport release/stable/6.6 |
✅ Backports have been createdDetails
|
…6.6/pr-23135 fix: cancel parent direct manipulations after press bubble completes (backport #23135)
GitHub Issue: closes https://github.com/unoplatform/kahua-private/issues/434
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️