Skip to content

[inflight/candidate] [Android] Fix CollectionView selection with pointer gestures (#37952) - #39387

Merged
kubaflo merged 1 commit into
inflight/candidatefrom
kubaflo-pointer-candidate-backport
Oct 14, 2026
Merged

kubaflo merged 1 commit into
inflight/candidatefrom
kubaflo-pointer-candidate-backport

Conversation

@kubaflo

@kubaflo kubaflo commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Exact backport of #37952, merged into inflight/current as cc8e3495d1e67c9e84964d80671424c4fa9fa39b.

Target exception: inflight/candidate is explicitly requested for this servicing backport, rather than the template's usual main target.

Preserves the final merged fix without additional dependencies, tests, or redesign: inspect the Android native view hierarchy for a clickable view, and retain pointer touch ownership only for the initial Down event when no clickable native view owns the sequence. This prevents a PointerGestureRecognizer inside a CollectionView item template from swallowing native item selection.

Only PointerGestureHandler.cs and TapAndPanGestureDetector.cs change: 19 insertions and one deletion. Candidate e741040bbd9ed84f5ee9fadab207501e4fa0e0a2 has byte-identical pre-fix contents to the source commit's parent in both files. The backport has byte-identical post-fix contents to the merged source. Both deltas have stable patch-id 845193da6780e357ad479b85bedc5560f875f860. Open and merged Candidate PRs were rechecked by source number, issue number, and mechanism immediately before publishing; no duplicate was found.

Local validation

Host SDK: 11.0.100-preview.6.26359.118; the Android build targets net10.0-android36.0, and managed tests run on net10.0.

Command Result
dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore -p:BuildTaskOnlyBuild=true -p:MauiPlatforms=net10.0-android36.0 -p:IncludePreviousTfms=false -v:minimal Initial attempt failed with missing dependency assets (NETSDK1004) and .NET Framework 4.7.2 reference assemblies (MSB3644); resolved by the following restore and retry.
dotnet restore Microsoft.Maui.BuildTasks.slnf -p:BuildTaskOnlyBuild=true -p:MauiPlatforms=net10.0-android36.0 -p:IncludePreviousTfms=false -v:minimal Passed.
dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore -p:BuildTaskOnlyBuild=true -p:MauiPlatforms=net10.0-android36.0 -p:IncludePreviousTfms=false -v:quiet '-clp:ErrorsOnly;Summary' Passed: 3 warnings, 0 errors.
dotnet build src/Controls/src/Core/Controls.Core.csproj -f net10.0-android36.0 --no-restore -p:MauiPlatforms=net10.0-android36.0 -p:IncludePreviousTfms=false -v:quiet '-clp:ErrorsOnly;Summary' Passed: 0 warnings, 0 errors.
dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -f net10.0 --filter 'FullyQualifiedName~Microsoft.Maui.Controls.Core.UnitTests.PointerGestureRecognizerTests' -p:MauiPlatforms=net10.0-android36.0 -p:IncludePreviousTfms=false -v:quiet '-clp:ErrorsOnly;Summary' Passed: 25 tests, 0 failed, 0 skipped.
dotnet format whitespace --folder --include src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs src/Controls/src/Core/Platform/Android/TapAndPanGestureDetector.cs --verify-no-changes --verbosity minimal Passed; source formatting preserved.
git diff --check origin/inflight/candidate...HEAD Passed.
git diff --exit-code cc8e3495d1e67c9e84964d80671424c4fa9fa39b HEAD -- src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs src/Controls/src/Core/Platform/Android/TapAndPanGestureDetector.cs Passed; exact merged-source postimages.
git diff cc8e3495d1e67c9e84964d80671424c4fa9fa39b^ cc8e3495d1e67c9e84964d80671424c4fa9fa39b | git patch-id --stable and git diff origin/inflight/candidate...HEAD | git patch-id --stable Passed; identical patch-id above.

Native validation gap: No emulator/device or manual UI validation was performed. The focused tests cover managed recognizer behavior, not Android native touch dispatch, CollectionView selection, or SelectionChanged. No XCTest, MacCatalyst testing, or foreground/device UI automation was run. CI results have not been evaluated in this task.

Issues Fixed

Fixes #34491 via backport of #37952.

…#37952)

Backport the exact two-file delta from cc8e349, merged into inflight/current for #34491. Preserve native clickable-view touch ownership so CollectionView selection is not swallowed by pointer gestures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dac2dd94-1d58-4022-b496-1ffe726b7768
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 14, 2026 16:06 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 14, 2026 16:06 — with GitHub Actions Inactive
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 14, 2026 16:07 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 14, 2026 16:09 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 14, 2026 16:11 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 14, 2026 16:11 — with GitHub Actions Inactive
@kubaflo
kubaflo merged commit 68cc03a into inflight/candidate Oct 14, 2026
9 of 18 checks passed
@kubaflo
kubaflo deleted the kubaflo-pointer-candidate-backport branch October 14, 2026 16:12
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Oct 14, 2026
kubaflo added a commit that referenced this pull request Oct 18, 2026
…ter gestures (#37952) (#39387)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Exact backport of [#37952](#37952),
merged into `inflight/current` as
[`cc8e3495d1e67c9e84964d80671424c4fa9fa39b`](cc8e349).

**Target exception:** `inflight/candidate` is explicitly requested for
this servicing backport, rather than the template's usual `main` target.

Preserves the final merged fix without additional dependencies, tests,
or redesign: inspect the Android native view hierarchy for a clickable
view, and retain pointer touch ownership only for the initial Down event
when no clickable native view owns the sequence. This prevents a
PointerGestureRecognizer inside a CollectionView item template from
swallowing native item selection.

Only `PointerGestureHandler.cs` and `TapAndPanGestureDetector.cs`
change: 19 insertions and one deletion. Candidate
`e741040bbd9ed84f5ee9fadab207501e4fa0e0a2` has byte-identical pre-fix
contents to the source commit's parent in both files. The backport has
byte-identical post-fix contents to the merged source. Both deltas have
stable patch-id `845193da6780e357ad479b85bedc5560f875f860`. Open and
merged Candidate PRs were rechecked by source number, issue number, and
mechanism immediately before publishing; no duplicate was found.

**Local validation**

Host SDK: `11.0.100-preview.6.26359.118`; the Android build targets
`net10.0-android36.0`, and managed tests run on `net10.0`.

| Command | Result |
| --- | --- |
| `dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore
-p:BuildTaskOnlyBuild=true -p:MauiPlatforms=net10.0-android36.0
-p:IncludePreviousTfms=false -v:minimal` | Initial attempt failed with
missing dependency assets (`NETSDK1004`) and .NET Framework 4.7.2
reference assemblies (`MSB3644`); resolved by the following restore and
retry. |
| `dotnet restore Microsoft.Maui.BuildTasks.slnf
-p:BuildTaskOnlyBuild=true -p:MauiPlatforms=net10.0-android36.0
-p:IncludePreviousTfms=false -v:minimal` | Passed. |
| `dotnet build Microsoft.Maui.BuildTasks.slnf --no-restore
-p:BuildTaskOnlyBuild=true -p:MauiPlatforms=net10.0-android36.0
-p:IncludePreviousTfms=false -v:quiet '-clp:ErrorsOnly;Summary'` |
Passed: 3 warnings, 0 errors. |
| `dotnet build src/Controls/src/Core/Controls.Core.csproj -f
net10.0-android36.0 --no-restore -p:MauiPlatforms=net10.0-android36.0
-p:IncludePreviousTfms=false -v:quiet '-clp:ErrorsOnly;Summary'` |
Passed: 0 warnings, 0 errors. |
| `dotnet test
src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -f
net10.0 --filter
'FullyQualifiedName~Microsoft.Maui.Controls.Core.UnitTests.PointerGestureRecognizerTests'
-p:MauiPlatforms=net10.0-android36.0 -p:IncludePreviousTfms=false
-v:quiet '-clp:ErrorsOnly;Summary'` | Passed: 25 tests, 0 failed, 0
skipped. |
| `dotnet format whitespace --folder --include
src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs
src/Controls/src/Core/Platform/Android/TapAndPanGestureDetector.cs
--verify-no-changes --verbosity minimal` | Passed; source formatting
preserved. |
| `git diff --check origin/inflight/candidate...HEAD` | Passed. |
| `git diff --exit-code cc8e349 HEAD --
src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs
src/Controls/src/Core/Platform/Android/TapAndPanGestureDetector.cs` |
Passed; exact merged-source postimages. |
| `git diff cc8e349^
cc8e349 \| git patch-id --stable` and
`git diff origin/inflight/candidate...HEAD \| git patch-id --stable` |
Passed; identical patch-id above. |

**Native validation gap:** No emulator/device or manual UI validation
was performed. The focused tests cover managed recognizer behavior, not
Android native touch dispatch, CollectionView selection, or
SelectionChanged. No XCTest, MacCatalyst testing, or foreground/device
UI automation was run. CI results have not been evaluated in this task.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #34491 via backport of
[#37952](#37952).

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dac2dd94-1d58-4022-b496-1ffe726b7768
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 15f07a2a Deployed Oct 14, 2026 by kubaflo via conclusion #2352
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant