Repository navigation
[WinUI] Fix CollectionView accessibility and focus restoration using ItemsRepeater - #38723
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38723Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38723" |
This comment has been minimized.
This comment has been minimized.
|
/azp run |
d89749b to
33f5351
Compare
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
Note 🔍
|
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 2 findings
See inline comments for details.
|
|
||
| foreach (var nativeItem in itemList) | ||
| { | ||
| var nativeItem = itemList[index]; |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Logic and Correctness — The new multi-select synchronization loop redeclares nativeItem inside foreach (var nativeItem in itemList), which is a C# scope error (CS0136) and breaks compilation for this handler. The current change also never advances index, so the intended index-based selection sync cannot work as written.
|
|
||
| protected override void OnApplyTemplate() | ||
| { | ||
| CleanUpAccessibilityHelper(); |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Accessibility — OnApplyTemplate() now calls CleanUpAccessibilityHelper() but never re-subscribes GettingFocus. Concrete failure: after template application/reapplication, keyboard Tab focus no longer redirects into the selected/first item, so CollectionView keyboard navigation/accessibility behavior regresses on subsequent focus entry.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expandEvaluation skipped: no usable current-PR results. 📊 maui-prPending; no results yet. 🧪 maui-pr-devicetestsNo current-PR results available. 🧪 maui-pr-uitestsNo current-PR results available. 🧭 Follow-up — actions and refreshNext action: Comment
|
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Note 🔍
|
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@SuthiYuvaraj — new AI review results are available based on commit
f2699b2.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ INCONCLUSIVE
Platform: WINDOWS · Base: net11.0 · Merge base: b10b2ecb
🩺 Pre-existing build failure (not the fix) — both the without-fix baseline AND the with-fix build fail with a build error, so the PR's fix is NOT the cause. This is a broken main/merge-base or a toolchain/environment failure (e.g. an ILLink IL1012 trimmer crash). The gate cannot verify anything; investigate the build environment rather than the PR.
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recogniz...
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 CollectionViewTests (CollectionView2RestoresFocusToLastFocusedItem, CollectionView2FocusesSelectedItemOnFirstEntry) Category=CollectionView |
🛠️ BUILD ERROR | 🛠️ BUILD ERROR |
🔴 Without fix — 📱 CollectionViewTests (CollectionView2RestoresFocusToLastFocusedItem, CollectionView2FocusesSelectedItemOnFirstEntry): 🛠️ BUILD ERROR · 13s
Error-relevant lines (filtered from the build log):
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Core\tests\DeviceTests.Shared\Core.DeviceTests.Shared.csproj::TargetFramework=net11.0-ios]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\TestUtils\src\DeviceTests\TestUtils.DeviceTests.csproj::TargetFramework=net11.0-ios]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\TestUtils\src\DeviceTests.Runners\TestUtils.DeviceTests.Runners.csproj::TargetFramework=net11.0-ios]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Core\src\Core.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Core\maps\src\Maps.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\src\Xaml\Controls.Xaml.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\Maps\src\Controls.Maps.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\tests\DeviceTests\Controls.DeviceTests.csproj::TargetFramework=net11.0-ios]
🟢 With fix — 📱 CollectionViewTests (CollectionView2RestoresFocusToLastFocusedItem, CollectionView2FocusesSelectedItemOnFirstEntry): 🛠️ BUILD ERROR · 14s
Error-relevant lines (filtered from the build log):
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Core\tests\DeviceTests.Shared\Core.DeviceTests.Shared.csproj::TargetFramework=net11.0-ios]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\TestUtils\src\DeviceTests.Runners\TestUtils.DeviceTests.Runners.csproj::TargetFramework=net11.0-ios]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\TestUtils\src\DeviceTests\TestUtils.DeviceTests.csproj::TargetFramework=net11.0-ios]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Core\src\Core.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Core\maps\src\Maps.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\src\Xaml\Controls.Xaml.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\Maps\src\Controls.Maps.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Graphics\src\Graphics\Graphics.csproj::TargetFramework=net11.0-ios26.5]
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recognized. [D:\a\1\s\src\Controls\tests\DeviceTests\Controls.DeviceTests.csproj::TargetFramework=net11.0-ios]
⚠️ Failure Details
- 🛠️ CollectionViewTests (CollectionView2RestoresFocusToLastFocusedItem, CollectionView2FocusesSelectedItemOnFirstEntry) without fix: build failed before tests could run
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recogniz...
- 🛠️ CollectionViewTests (CollectionView2RestoresFocusToLastFocusedItem, CollectionView2FocusesSelectedItemOnFirstEntry) with fix: build failed (fix does not compile)
D:\a\1\s\.dotnet\sdk\11.0.100-rc.2.26470.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(133,5): error NETSDK1139: The target platform identifier ios was not recogniz...
📁 Fix files reverted (5 files)
src/Controls/src/Core/Handlers/Items2/CollectionViewHandler2.Windows.cssrc/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.Windows.cssrc/Controls/src/Core/Handlers/Items2/Windows/ItemFactory.cssrc/Controls/src/Core/Handlers/Items2/Windows/MauiItemsView.cssrc/Controls/src/Core/Platform/Windows/CollectionView/ItemsViewStyles.xaml
New files (not reverted):
src/Controls/src/Core/Handlers/Items2/Windows/ItemsViewAccessibilityHelper.cssrc/Controls/src/Core/Handlers/Items2/Windows/MauiItemsViewAutomationPeer.cs
📋 Pre-Flight — Context & Validation
PR #38723 Pre-Flight
Context
- PR:
[WinUI] Fix CollectionView accessibility and focus restoration using ItemsRepeater - Issue: #38660, a Windows CollectionView2 regression introduced in .NET 11 preview 6. Keyboard Tab navigation skips the CollectionView, item focus/navigation is unreliable, and screen readers do not announce item semantic descriptions/hints.
- Base / review commit:
net11.0atb10b2ecb; squashed review commit848bf9af6b. - Active path:
src/Controls/src/Core/Handlers/Items2/**is the default .NET 11 Windows CollectionView handler. The legacyItems/**path is out of scope.
Existing PR Approach
The PR changes nine files (+858/-22), including two new production files:
CollectionViewHandler2.Windows.cswires and tears down accessibility/focus state.ItemsViewHandler2.Windows.cs,MauiItemsView.cs, andItemFactory.csexpose realization events, keep automation set metadata current, and refresh item semantic properties.- New
ItemsViewAccessibilityHelper.cstracks the last focused item, redirects keyboard entry, waits for virtualized containers to be prepared, queues focus, and falls back to the selected or first realized item. - New
MauiItemsViewAutomationPeer.cssupplies CollectionView identity/pattern behavior. ItemsViewStyles.xamlchanges native focus/tab behavior.- Device tests explicitly register
CollectionViewHandler2and add the two focus regressions below.
An alternative must use a different root-cause mechanism, not merely move the same last-focused-index/container-prepared state machine to another file.
Required Validation
Platform: windows. Run only the Controls device-test project with a filter selecting both methods:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "FullyQualifiedName~CollectionView2RestoresFocusToLastFocusedItem|FullyQualifiedName~CollectionView2FocusesSelectedItemOnFirstEntry"Mandatory regression tests:
CollectionViewTests.CollectionView2RestoresFocusToLastFocusedItemCollectionViewTests.CollectionView2FocusesSelectedItemOnFirstEntry
Do not run the full suite and do not rerun gate verification.
Existing Evidence and Constraints
- Gate result is INCONCLUSIVE, not a fix failure. Both baseline and PR builds stop before tests with
NETSDK1139because the Windows environment does not recognize iOS target platform identifiers. - Regression cross-reference found no overlap with recent labeled bug-fix PRs touching these files.
- The try-fix baseline boundary is significant: the PR introduces
ItemsViewAccessibilityHelper.csandMauiItemsViewAutomationPeer.cs. IfEstablishBrokenBaseline.ps1records either inNewFiles, the try-fix skill requires a truthful Blocked result before editing, followed by its mandatory restore. - Pre-existing dirty script files are harness-owned and unrelated; do not alter, restore, or delete them.
- Follow the Windows CollectionView, handler-detection, handler, performance-hotpath, threading, public-API, and device-test repository instructions for any eligible edit.
🔬 Code Review — Deep Analysis
Expert Evaluation — Submitted PR
Verdict: NEEDS_DISCUSSION
Confidence: low
The submitted Windows CollectionView2 fix adds keyboard focus restoration, accessibility metadata, a MauiItemsView automation peer, lifecycle cleanup/reattachment, and focused regression coverage. The expert review found no actionable error, warning, or suggestion on the added or modified lines; inline-findings.json therefore contains an empty JSON array.
The implementation's lifecycle and virtualization paths are internally coherent: disconnect/reconnect reattaches the helper without accumulating subscriptions, pending focus work is cancelled when state changes, template reapplication removes prior repeater event handlers, and deferred focus is tied to realization of the intended item. Accessible prior error-level review concerns were found to be addressed by the submitted head.
The review cannot recommend unconditional approval from code evidence alone because the trusted Gate is inconclusive (NETSDK1139 prevented the required Windows device tests from building or running). This is an evidence gap, not a regression-test failure and not an identified defect in the fix.
Findings
No actionable inline findings.
Blast Radius and Failure-Mode Probing
- The behavior is confined to the Windows CollectionView2 handler path, but it runs for all instances on that path.
- No new global/static mutable state is introduced.
- Handler disconnect/reconnect is symmetric: cleanup removes subscriptions and reconnect reattaches the helper.
- Items-source changes and pending virtualized-container focus requests cancel stale deferred work.
- Template reapplication cleans repeater automation handlers before adding replacements.
- Null or unrealized focus targets use guarded fallback/deferred paths rather than unconditional platform access.
Validation Status
The Gate result remains INCONCLUSIVE. It must not be interpreted as either a passing or failing candidate.
🛠️ Try-Fix — Analysis & Comparison
Candidate 1 Try-Fix Narrative (PR #38723)
Status
Blocked before edits or tests.
Approach Description
Candidate 1 executed the mandatory try-fix workflow and first attempted to establish the broken baseline. Baseline creation failed because eight pre-existing dirty tracked script files made the working directory ineligible. No .github/.baseline-state.json was created, so there was no RevertedFiles edit allow-list.
Prior Approach Avoided and Mechanism-Level Difference
The existing PR uses an ItemsViewAccessibilityHelper state machine: it tracks the last-focused integer index, intercepts GettingFocus, waits for ContainerPrepared when virtualization hides a target, and queues explicit focus. It also adds a custom automation peer and semantic metadata wiring. Candidate 1 did not implement, relocate, or rewrite that mechanism. Its only difference was procedural safety enforcement: it stopped before mutation when baseline restoration guarantees were unavailable. Candidate 1 therefore produced no fix mechanism to repeat or compare behaviorally.
Files Changed
No production, source, test, or pre-existing dirty files were changed. Candidate 1 created only its required attempt artifacts under:
CustomAgentLogsTmp/PRState/38723/PRAgent/try-fix/attempt-1/
Those artifacts were baseline.log, approach.md, reviewer-findings.json, reviewer-findings.diff, result.txt, fix.diff, test-output.log, and analysis.md.
Exact Captured Diff
The candidate diff was empty.
Test Command and Results
Required command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "FullyQualifiedName~CollectionView2RestoresFocusToLastFocusedItem|FullyQualifiedName~CollectionView2FocusesSelectedItemOnFirstEntry"The command was not executed because Step 2 failed before a safe baseline and editable allow-list existed. Candidate 1 ran no other tests.
Failure / Blocker Analysis
EstablishBrokenBaseline.ps1 reported that the working directory was not clean because of eight pre-existing dirty tracked script files. The baseline log had no Baseline established marker, and .github/.baseline-state.json was absent. Under the try-fix boundary, source edits and testing were forbidden. This was a safety blocker, not a behavioral result for a proposed fix.
Self-Review
0 findings. reviewer-findings.json contained []; there was no candidate diff to review.
Restoration Result
Exact command executed:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -RestoreOutput reported No baseline state found and Restored: False. That was the expected result for the verified no-state path, and Candidate 1 made no attempt edits.
Candidate 2 Try-Fix Narrative (PR #38723)
Status
Blocked before edits or tests.
Approach / Intended Approach: Native Roving ItemContainer Tab Stop
Candidate 2's intended alternative treats the regression as a broken WinUI tab-candidate graph, rather than a missing programmatic focus request. The proposed mechanism would keep the MauiItemsView owner, wrapper, and repeater out of the tab order and make exactly one realized data ItemContainer the native tab stop. Initial realization would seed that active stop from the selected item, falling back to the first data item. When keyboard focus moves to another item, the native focus event would transfer the tab-stop role to that container. After focus leaves the CollectionView, WinUI's normal tab traversal would therefore re-enter the currently active container.
The likely eligible implementation locations would have been the existing ItemFactory.cs container setup/recycle path and ItemsViewStyles.xaml tab configuration, subject to the baseline RevertedFiles allow-list. No implementation was permitted because that allow-list was never created.
Candidate 1 Result Avoided and Mechanism-Level Difference
Candidate 1 was blocked at baseline, made no edits, ran no tests, and supplied no fix mechanism. Candidate 2 did not inspect Candidate 1's attempt directory; it used only the recorded Candidate 1 result. Although the same unchanged worktree caused the same mandatory safety block, Candidate 2 independently identified a concrete native-container alternative rather than treating the safety block as a solution.
The PR's helper reconstructs focus from an integer index: it cancels GettingFocus, may scroll the target into view, subscribes to ContainerPrepared, and dispatches an explicit Focus call guarded by queued-state and cancellation state. The intended roving-tab-stop mechanism instead changes WinUI's native focus candidate graph as containers are realized and focused. Normal keyboard traversal itself would select the selected/last-active container. It would not cancel entry, recover an index, wait for ContainerPrepared, queue focus, or use a helper focus state machine. This is a different cause-to-effect chain, not a relocation or light rewrite of the PR helper.
Baseline Establishment
Exact command executed:
pwsh .github/scripts/EstablishBrokenBaseline.ps1It exited with code 1 and reported DIRTY WORKING DIRECTORY - Cannot establish baseline. The eight pre-existing tracked paths were:
.github/scripts/CopilotPipeline.Tests.ps1.github/scripts/Review-PR.Tests.ps1.github/scripts/RunTests.ps1.github/scripts/Set-ScreenResolution.Tests.ps1(pre-existing deletion).github/scripts/shared/Detect-TestsInDiff.ps1.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1eng/scripts/Set-ScreenResolution.ps1eng/scripts/update-cgmanifest.ps1
Verification found no Baseline established marker and confirmed .github/.baseline-state.json did not exist. Consequently there was no RevertedFiles allow-list. The skill requires Blocked before any tracked edit on this verified no-state path.
Files Changed
No production, source, test, or pre-existing dirty files were changed.
Required attempt artifacts were created under:
CustomAgentLogsTmp/PRState/38723/PRAgent/try-fix/attempt-2/
including baseline.log, approach.md, reviewer-findings.json, reviewer-findings.diff, result.txt, fix.diff, test-output.log, analysis.md, and restore.log. result.txt contains Blocked.
Exact Candidate Diff
The candidate-scoped diff is explicitly empty. The unrelated eight dirty tracked script paths pre-dated this attempt and were preserved; they are not candidate changes.
Test Command and Results
Only allowed command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "FullyQualifiedName~CollectionView2RestoresFocusToLastFocusedItem|FullyQualifiedName~CollectionView2FocusesSelectedItemOnFirstEntry"The command was not executed because mandatory Step 2 failed before creating an editable baseline. Therefore neither CollectionViewTests.CollectionView2RestoresFocusToLastFocusedItem nor CollectionViewTests.CollectionView2FocusesSelectedItemOnFirstEntry ran. Candidate 2 ran no other test or build command and did not rerun gate verification. There is no behavioral Pass/Fail claim and no new NETSDK1139 result; the attempt status is solely Blocked by baseline safety.
Failure / Blocker Analysis
The baseline script rejects any dirty tracked worktree and did so before reverting the PR files. Since it created no state file, script-only restoration could not track or safely restore an implementation. Editing either existing or newly added PR production files would have violated the absolute baseline boundary. Candidate 2 therefore stopped before code mutation, as required. This does not disprove the intended native roving-tab-stop hypothesis; it means the hypothesis could not be implemented or empirically evaluated in this worktree.
Expert Self-Review
0 findings (reviewer-findings.json is []). Candidate 2 reviewed the eight overarching principles and the always-active Logic and Correctness, Regression Prevention, and Complexity Reduction dimensions inline. Because the candidate diff is empty, there was no changed line on which to record a finding. The test loop made no code changes, so the self-review remained current and no refresh was required. Self-review finding count: 0 (one inline review pass).
Restoration Result
After the artifact gate passed, Candidate 2 executed exactly:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -RestoreOutput:
No baseline state found. Nothing to restore.
Message No baseline state found
Restored False
This is the required and accepted restoration outcome for a verified no-state path with no attempt edits. A post-restore verification confirmed .github/.baseline-state.json remained absent and git status --short still listed exactly the same eight pre-existing dirty tracked script paths. No pre-existing dirty or untracked path was altered.
Final Result
- Result: Blocked
- This attempt's status: Done
- Reasoning: The one intended alternative was fully identified, but baseline safety preconditions failed before implementation or testing. The required artifacts and narrative were captured, and the exact restore command completed with the expected verified no-state outcome.
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner
pr — the raw submitted PR fix.
The submitted implementation is the only substantive completed fix. The single expert review found no actionable diff-level findings, and its failure-mode analysis confirmed coherent handling of reconnects, stale deferred focus work, template reapplication, virtualization, and selection/focus separation. The trusted Gate is INCONCLUSIVE, so the behavior remains unverified; however, this is an environment/build limitation (NETSDK1139), not a failed regression result, and the Gate instructions explicitly prohibit requesting changes solely for that outcome.
Candidate Comparison
| Rank | Candidate | Implementation | Expert review | Required regression tests | Assessment |
|---|---|---|---|---|---|
| 1 | pr |
Complete submitted Windows CollectionView2 accessibility/focus fix | No actionable findings | Not built or run; Gate INCONCLUSIVE | Best candidate on code merit; no source change was identified |
| 2 | pr-plus-reviewer |
Identical production/test behavior to pr; reviewer.patch is empty |
No feedback existed to apply | Not run because the conditional refinement step was not triggered | Correct but provides no improvement over the raw PR |
| 3 | try-fix-2 |
No diff; only an unimplemented roving-tab-stop design | Empty-diff self-review found nothing | Not run; candidate was Blocked before edits | Interesting hypothesis, but no code or behavioral evidence |
| 4 | try-fix-1 |
No diff and no alternative mechanism | Empty-diff self-review found nothing | Not run; candidate was Blocked before edits | Procedurally safe but not a fix candidate |
No candidate passed or failed the regression tests. The raw PR and pr-plus-reviewer inherit the same inconclusive Gate evidence; both try-fix candidates were blocked before testing. Therefore the rule that a regression-test failure ranks below a pass does not alter this ordering.
Why pr Wins
- It directly addresses the active .NET 11 Windows CollectionView2 handler path.
- It supplies the focus-restoration state machine, automation peer behavior, semantic metadata updates, lifecycle cleanup/reattachment, and focused device tests described by the issue.
- The expert review produced
[]ininline-findings.json; no consolidated refinement was justified. - Choosing the identical
pr-plus-reviewercopy would falsely imply that reviewer-authored changes are needed. - Neither try-fix candidate contains an executable implementation or test result.
Remaining Uncertainty
The two required Windows device tests did not execute because the environment failed before test execution with NETSDK1139. Approval here is a code-review recommendation, not a claim that the regression tests passed; CI or a compatible Windows environment still needs to establish behavioral verification.
📱 UI Tests — CollectionView
Detected UI test categories: CollectionView
[!WARNING]
No UI test results were produced for the detected categories. The trusted gate was
inconclusive and did not establish whether the PR build was healthy. The deep UI stage also
returned no results, usually because of a build, environment, or infrastructure interruption;
inspect the Gate section and independent CI checks before retrying.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
kubaflo
left a comment
There was a problem hiding this comment.
Could you please check the ai's suggestions?
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!
Issue Description
CollectionViewon WinUI is implemented usingItemsRepeater. WhileItemsRepeaterprovides virtualization and item realization, it does not provide the complete accessibility and keyboard navigation behavior expected byCollectionView.There are two primary issues:
1. Focus Restoration
ItemsRepeaterdoes not track the last focused item or provide APIs to restore focus to a specific item. When keyboard navigation returns to theCollectionView, there is no built-in mechanism to determine which item should regain focus.Additionally, due to virtualization, the target item may not be realized at the time focus is requested, preventing focus from being applied immediately.
2. Selection and Keyboard Navigation
ItemsRepeaterdoes not supportSingleSelectionFollowFocus.In
SelectionMode.Single, keyboard navigation usingTaband Arrow keys can trigger selection-related behavior that differs from the expectedCollectionViewexperience.WinUI's selection-follow-focus implementation assumes that the selected item is a native
UIElement. In .NET MAUI, the selected item is typically a bound data object. This mismatch can result in an invalid COM cast and cause anE_NOINTERFACE("No such interface supported") exception during keyboard navigation.Root Cause
ItemsViewis responsible for selection and current-item semantics:SelectionModeand selected-item state.CurrentItemIndex.ItemsRepeater, however, is only responsible for realizing and recycling item containers. It does not maintain selection, current-item state, or focus restoration behavior required byCollectionView.Fix Description
MauiItemsViewas a tab stop after the control is loaded, allowing keyboard users to re-enter the control.AutomationPeerforMauiItemsViewto provide CollectionView-specific accessibility behavior not available throughItemsRepeater.ItemsViewAccessibilityHelperto:ItemsRepeatervirtualization.Issues Fixed
Fixes #38660
Tested the behaviour in the following platforms
Output Screenshot
Issuereport.mp4
fixAfterTrim.mp4