Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a Skia regression where ListView item selection breaks when an ItemContainer is the root of the ItemTemplate, by releasing Uno’s internal pointer capture without surfacing PointerCaptureLost to ancestors during normal release/cancel flows. It adds runtime tests to prevent regressions and a SamplesApp page to manually validate pointer event behavior and selection.
Changes:
- Release
ItemContainer’s internal pointer capture usingmuteEvent: trueinOnPointerReleased/OnPointerCanceledto avoid raisingPointerCaptureLostduring a normal click/tap. - Add new
Given_ItemContainerruntime tests covering mouse click selection, touch tap selection, and touch scroll-not-select behavior. - Add a SamplesApp page to compare
ListViewbehavior with/withoutItemContainerand display pointer diagnostics.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Controls/ItemContainer/ItemContainer.cs | Mutes pointer-capture release to avoid bubbling PointerCaptureLost to ancestor selectors during release/cancel. |
| src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_ItemContainer.cs | Adds regression tests ensuring selection works and pointer pressed/released bubble as expected when ItemContainer is used in an ItemTemplate. |
| src/SamplesApp/SamplesApp.Samples/Microsoft_UI_Xaml_Controls/ItemContainerTests/ItemContainer_In_ListView_ItemTemplate.xaml.cs | Adds a manual validation page code-behind with selection and pointer event diagnostics. |
| src/SamplesApp/SamplesApp.Samples/Microsoft_UI_Xaml_Controls/ItemContainerTests/ItemContainer_In_ListView_ItemTemplate.xaml | Defines the manual validation UI comparing ListView templates side-by-side. |
Comments suppressed due to low confidence (1)
src/Uno.UI/UI/Xaml/Controls/ItemContainer/ItemContainer.cs:525
- Same as in
OnPointerReleased: usingReleasePointerCapture(..., muteEvent: true)will currently trigger the Info log path even when the capture was actually released, because the internalRelease(...)returnsfalsewhenmuteEventis set. This can produce misleading/verbose logging on every cancel path when Information logging is enabled.
// Muted for the same reason as in OnPointerReleased: this capture doesn't exist on WinUI and
// ancestors already receive the PointerCanceled event itself.
ReleasePointerCapture(args.Pointer.UniqueId, muteEvent: true);
💡 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-23919/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-23919/wasm-skia-net9/index.html |
|
@ramezgerges isn't this related to a fix you have done a while back on |
|
Tick the box to add this pull request to the merge queue (same as
|
GitHub Issue: closes #23892
PR Type:
🐞 Bugfix
What changed? 🚀
When an
ItemContaineris used as the root element of aListView.ItemTemplate, clicking an item no longer selected it on Skia targets (regression vs 6.5.36, related to #23841).Root cause: unlike WinUI, Uno's
ItemContainerexplicitly captures the pointer on press to keep its visual states accurate (#23056). On release,ReleasePointerCapturesynchronously raisedPointerCaptureLost, which bubbled to the hostingListViewItemduring thePointerReleaseddispatch.SelectorItemsubscribes toPointerCaptureLost(withhandledEventsToo) to clean up scroller-canceled interactions, so it treated the click as canceled and never raised the selection.The fix releases the Uno-internal capture with
muteEvent: trueinOnPointerReleasedandOnPointerCanceled— this capture doesn't exist on WinUI, so noPointerCaptureLostshould surface from it (same approach asHyperlink). The scroll-steal cancellation path (CanceledByDirectManipulation) is unaffected and still aborts clicks while panning.Validation:
Given_ItemContainerruntime tests (mouse click, touch tap, touch scroll-must-not-select) fail before the fix and pass after, and assertPointerPressed/PointerReleasedbubble to theListViewwhile noPointerCaptureLostis raised for a simple click.SelectorBarTestsandItemsViewTestssuites pass, guarding the previous fixes in this area (fix(selectorbar): adjust tracking of isOver mouse state #23208, fix(itemcontainer): snapshot isOver before capture release #23877).ItemContainer_In_ListView_ItemTemplate(ItemContainer ListView vs standard ListView side by side, with pointer diagnostics), manually validated on Skia macOS desktop.Note: after mixed left+right mouse button presses on the same container, the pressed state can remain stale — verified this matches upstream WinUI
ItemContainer.cppbehavior verbatim (parity), so it is intentionally not changed here.PR Checklist ✅
Screenshots Compare Test Runresults.