Skip to content

fix(itemcontainer): snapshot isOver before capture release - #23877

Merged
ajpinedam merged 2 commits into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.skia.selectorbar.touch.selection
Jul 27, 2026
Merged

ajpinedam merged 2 commits into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.skia.selectorbar.touch.selection

Conversation

@ajpinedam

@ajpinedam ajpinedam commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #23876

PR Type:

🐞 Bugfix

What changed? 🚀

Tapping a SelectorBarItem (or any ItemsView-based selection) with touch or pen does nothing on Skia targets, while mouse clicks work. #23208 fixed the mouse path only.

ItemContainer.OnPointerReleased calls ReleasePointerCapture before evaluating the item-invoke gate. On managed pointers that release synchronously raises PointerCaptureLost → ProcessPointerCanceled, which resets the touch/pen pointer-over state — so the gate's IsPointerOver() check fails and ItemInvoked(PointerReleased) (the only trigger ItemsView selects on; Tap is a selection no-op) is never raised.

This PR snapshots the pointer-over state before releasing the capture and uses the snapshot in the invoke gate. This fixes the re-entrancy at its source for all pointer device types, while keeping WinUI's genuine-cancel semantics (a real cancellation, e.g. a scroll stealing the pointer, still resets the touch/pen over-state and its visual state).

Validation (Skia Desktop macOS, Release):

  • New runtime test SelectorBarTests.VerifySelectorBarItemBecomesSelectedAfterTouchTap (touch-injection twin of the fix(selectorbar): adjust tracking of isOver mouse state #23208 mouse test): fails before the fix, passes after.
  • SelectorBarTests 6/6 passed (including the mouse test and the release-outside-bounds visual-state guard — no regression).
  • ItemsViewTests 10/10 passed.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_014Cwnh87BjMzYGmCtEcVYhf

Copilot AI review requested due to automatic review settings July 25, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Skia touch/pen selection for SelectorBarItem (and ItemsView-based selection) by avoiding re-entrancy that clears the pointer-over state during OnPointerReleased. This aligns the touch/pen path with the previously-fixed mouse path and adds a runtime test to prevent regressions.

Changes:

  • Snapshot m_pointerInfo.IsPointerOver() before ReleasePointerCapture() so the invoke gate is evaluated against the pre-release state.
  • Add a new runtime test validating SelectorBarItem selection via injected touch tap.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Uno.UI/UI/Xaml/Controls/ItemContainer/ItemContainer.cs Fixes pointer capture release re-entrancy by snapshotting pointer-over state before releasing capture.
src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/SelectorBar/SelectorBarTests.cs Adds a touch-injection runtime test to ensure SelectorBarItem selection works for touch taps on Skia.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ajpinedam
ajpinedam requested a review from ramezgerges July 25, 2026 12:28
@unodevops

Copy link
Copy Markdown
Contributor

@mergify

mergify Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ajpinedam
ajpinedam merged commit 524193c into unoplatform:master Jul 27, 2026
47 checks passed
@ajpinedam
ajpinedam deleted the dev/anpi/fix.skia.selectorbar.touch.selection branch July 27, 2026 14:37
@agneszitte

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/6.6

@mergify

mergify Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.6

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request Jul 27, 2026
…6.6/pr-23877

fix(itemcontainer): snapshot isOver before capture release (backport #23877)
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.

SelectorBar/ItemsView items not selected on touch tap (Skia iOS/Android)

5 participants