Skip to content

fix: cancel parent direct manipulations after press bubble completes (backport #23135) - #23364

Merged
agneszitte merged 2 commits into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23135
Jun 1, 2026
Merged

agneszitte merged 2 commits into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23135

Conversation

@mergify

@mergify mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

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:

Other information ℹ️


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

…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.

(cherry picked from commit 72706c0)
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.

(cherry picked from commit f347111)
@agneszitte
agneszitte merged commit bb81e9e into release/stable/6.6 Jun 1, 2026
9 of 11 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.6/pr-23135 branch June 1, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants