Fix: ListView scroll when using SwipeControl#23249
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a managed-pointer direct manipulation cancellation behavior where a descendant’s CancelDirectManipulations request could incorrectly cancel orthogonal-axis ancestor manipulations (e.g., SwipeControl horizontal manipulation inside a vertically scrolling ListView), breaking vertical scrolling. It introduces an axis-aware conflict check by peeking the ancestor handlers’ currently accepted manipulation modes and adds a regression runtime test.
Changes:
- Make ancestor direct-manipulation cancellation axis-aware via a new handler “accepted modes” preview.
- Extend
IDirectManipulationHandlerwithGetCurrentlyAcceptedModes()(defaulting toAll) and implement it forScrollContentPresenter. - Add a runtime regression test for vertical scrolling with
SwipeControlitems inside aListView.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.ManagedDirectManip.cs | Adds axis-aware ancestor DM cancellation via ConflictsWithRequester and handler mode peeking. |
| src/Uno.UI/UI/Xaml/Internal/IDirectManipulationHandler.cs | Adds GetCurrentlyAcceptedModes() with a default implementation to preserve legacy behavior. |
| src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.Managed.cs | Implements GetCurrentlyAcceptedModes() by reusing the accepted-mode computation logic. |
| src/Uno.UI.RuntimeTests/Tests/Uno_UI_Xaml_Core/Given_InputManager.cs | Adds regression test ensuring vertical scroll still works with SwipeControl items. |
💡 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-23249/wasm-skia-net9/index.html |
|
|
|
I see test When_DirectManipulationDisabled(TranslateX) is failing, when investigating I got this: The test is encoding a contract that directly contradicts the premise of the axis‑aware fix on this branch. Here's the mechanics step by step: What the test asserts (Given_InputManager.cs:1402-1445, introduced Aug 2025 by commit d72aee1 "feat: Add support for ManipulationMode=None"):
Why the new axis logic produces 620px instead of 0:
cc: @dr1rrb @agneszitte |
dr1rrb
left a comment
There was a problem hiding this comment.
Not sure about the exact interaction result we want (i.e. we need to validate on WinUI), but looks good to me
A |
Update the TranslateX test so that it allows TranslateY . |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/Uno.UI.RuntimeTests/Tests/Uno_UI_Xaml_Core/Given_InputManager.cs:1407
- This test currently expects
ManipulationModes.TranslateRailsXto cancel the ancestor ScrollViewer’s vertical scroll (expectsVerticalOffset == 0). With the new axis-aware cancellation intent,TranslateRailsXis still an X-only translation request, so a vertical drag should likely continue to scroll the ancestor (similar to theTranslateXrow). IfConflictsWithRequesteris updated to treat rails as axis-specific, update this expected outcome accordingly.
[DataRow(ManipulationModes.TranslateX, true)] // Descendant claims X only -> parent's Y-axis scroll must still work.
[DataRow(ManipulationModes.TranslateY, false)]
[DataRow(ManipulationModes.TranslateRailsX, false)]
[DataRow(ManipulationModes.TranslateRailsY, false)]
[DataRow(ManipulationModes.TranslateInertia, false)]
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23249/wasm-skia-net9/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23249/wasm-skia-net9/index.html |
GitHub Issue: closes https://github.com/unoplatform/kahua-private/issues/477
PR Type:
🐞 Bugfix
What changed? 🚀
CancelDirectManipulations cancelled every ancestor direct manipulation regardless of axis, so a SwipeControl (TranslateX) inside a ListView killed the parent ScrollContentPresenter's (TranslateY) DM and vertical scrolling died
Fix: Made ConflictsWithRequester axis-aware via a new IDirectManipulationHandler.GetCurrentlyAcceptedModes() peek — a pure-translation requester now only cancels ancestors that share an axis, while multi-pointer (Scale/Rotate) requesters and System/None-mode requesters keep the legacy "cancel everything" behavior so pinch-in-ScrollViewer fix is preserved
related to this change: #23135
PR Checklist ✅
Screenshots Compare Test Runresults.