Skip to content

[Windows] ScrollView: Prevent automatic Entry focus - #37428

Merged
kubaflo merged 11 commits into
inflight/currentfrom
jfversluis-fix-entry-focus-windows
Aug 27, 2026
Merged

kubaflo merged 11 commits into
inflight/currentfrom
jfversluis-fix-entry-focus-windows

Conversation

@jfversluis

@jfversluis jfversluis commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

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

On Windows, WinUI's initial focus routing can select the first focusable descendant of a ScrollViewer. When a page opens with an Entry inside a scrollable MAUI ScrollView, that can focus the Entry and raise its Focused event without user input.

The Windows handler now makes the native ScrollViewer a transient tab stop from WinUI's Loading event, giving the load-time focus pass a non-content target. A queued callback restores the original native, styled, locally customized, or bound IsTabStop state after load, so the ScrollViewer does not become a permanent keyboard or Narrator stop. A low-priority fail-safe queued from Loading also restores the transient state if the ScrollViewer leaves the native visual tree before either Loaded or Unloaded fires. The normal Loaded callback supersedes that fail-safe through a generation guard and restores on the next dispatcher turn.

The temporary value is represented by an owned binding: if an app or mapper writes the native property before restore, that write replaces the binding and wins. Generation plus platform-view identity checks prevent stale callbacks from mutating a disconnected or replaced handler. Cleanup and restoration intentionally happen before base.DisconnectHandler, while the platform view and handler ownership are still valid; all lifecycle events are unsubscribed before base teardown.

The shared Windows unfocus path preserves the original binding/local/style/default ownership of IsTabStop, so an unfocus operation during the temporary window cannot convert the transient value into a permanent local tab stop. Bindings are detached before the temporary false write so TwoWay sources are not mutated, then the original binding object is reinstated.

No public API is added or changed.

What NOT to Do

  • Do not make the internal ContentPanel a tab stop: it creates an invisible, unannounced keyboard stop.
  • Do not leave ScrollViewer.IsTabStop=true permanently: that changes steady-state tab order and accessibility for every Windows ScrollView.
  • Do not set AllowFocusOnInteraction=false: empirical testing showed that it also prevents legitimate pointer focus of child Entries.
  • Do not restore a hardcoded IsTabStop value: doing so destroys style, binding, and custom handler/mapper ownership.
  • Do not write a temporary dependency-property value while a TwoWay binding is attached: that pushes the temporary value into the source.
  • Do not use a normal-priority fail-safe from Loading: it can run before WinUI reaches Loaded, restoring too early and reintroducing automatic Entry focus. The fail-safe must remain low priority.
  • Do not synchronously restore when the low-priority Loading enqueue fails: empirical testing showed that removing the transient target during Loading recreates automatic Entry focus. Dispatcher shutdown remains covered by synchronous handler disconnect cleanup.
  • Do not cancel GettingFocus to identify automatic focus: WinUI reports both automatic and legitimate app requests as programmatic focus, so that signal cannot distinguish them safely.

Issues Fixed

Fixes #31039

Validation

  • Windows Controls ScrollView device tests with the fix: 26 passed, 0 failed. Coverage includes direct transient activation, lifecycle ordering through Loaded, negative startup focus with a preceding Button and two sibling ScrollViews, native/default/local/style/OneWay/TwoWay ownership, binding detachment, TwoWay source and binding identity, later native writes, unfocus during the transient window, explicit focus, disconnect/reconnect, unload/reload, stale callbacks, native focused-element state, rooted Tab and Shift+Tab navigation, and removal from the native visual tree during Loading before Loaded/Unloaded.
  • Controlled sensitivity with only production Loading activation disabled: 20 passed, 6 failed. The discriminating failures are startup focus, preceding-control/two-ScrollView startup focus, navigation reload, transient ordering, reverse navigation from the startup ScrollViewer, and custom local-value restoration.
  • Windows Controls Entry device tests: 54 passed, 0 failed, 4 skipped. A non-ScrollView regression test verifies that programmatic Unfocus preserves style ownership and tracks a later style replacement.
  • The issue author's exact attached sample was rebuilt against the unchanged production implementation represented by head 21d3526a1b and automated with UI Automation plus real pointer/keyboard input:
    • startup focus is the native ScrollViewer UIA Pane, exposed as a control/content element; no Entry focus and no alert;
    • clicking a normal Entry focuses it;
    • Tab advances to the next Entry;
    • Shift+Tab returns to the previous Entry;
    • clicking an InputTransparent Entry does not raise the first Entry's focus alert.
  • Independent MAUI-specialist and adversarial lifecycle reviews found no remaining high-confidence defect after the added fail-safe and discriminating coverage.
  • Optional device build 1565839 contained one unrelated MacCatalyst CarouselView leak failure; its osx.26 Helix job passed. Optional UI build 1565837 had broad cross-platform baseline failures also present on adjacent main builds. Required main build 1565836 passed.

Empirical Proof

Before — untouched attached sample (MAUI 9.0.14):

issue-31039-before-fix.mp4

After — exact sample rebuilt against the transient fix:

issue-31039-after-fix-transient.mp4

@Kamalesh-Periyasamy, once the updated PR artifacts are available, please try them with your original reproduction and let us know whether this resolves the issue for you.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bcd06486-88bb-4458-ad38-55bf1be162f5
Copilot AI lite review requested due to automatic review settings August 14, 2026 12:18
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37428

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37428"

@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

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 14, 2026

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

This PR updates the Windows ScrollViewHandler to mitigate WinUI ScrollViewer focus-routing behavior that can automatically focus the first focusable descendant (e.g., the first Entry) when the ScrollView content region receives focus/pointer interaction, and adds a Windows device test to cover the new internal configuration.

Changes:

  • Configure the Windows ScrollView “padding shim” ContentPanel to participate in focus handling (IsTabStop) and opt out of UIA control/content views (AccessibilityView.Raw).
  • Toggle the shim’s IsTabStop when content is removed/re-added to avoid leaving an empty focusable element.
  • Add a Windows device test asserting the shim’s tab-stop and accessibility-view state across content changes and handler disconnect/reconnect.
Show a summary per file
File Description
src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs Enables/disables ContentPanel.IsTabStop based on content presence and marks the shim as AccessibilityView.Raw to keep it out of UIA control/content views.
src/Core/tests/DeviceTests/Handlers/ScrollView/ScrollViewHandlerTests.Windows.cs Adds a Windows regression test validating the shim’s tab-stop/accessibility-view configuration and state transitions.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

@jfversluis

jfversluis commented Aug 14, 2026 •

Copy link
Copy Markdown
Member Author

Updated empirical proof after review changes

The implementation was revised in 7204e8e867 to use the native WinUI ScrollViewer as the focus target, removing the invisible internal ContentPanel tab stop. Both recordings use the issue author's exact attached reproduction.

Before — untouched attachment on MAUI 9.0.14

The first Entry receives focus during startup and immediately opens its Focused alert.

issue-31039-before-fix.mp4

After — exact attachment rebuilt against 7204e8e867

The recording and UI Automation trace verify:

  • startup: no alert and no Entry focused;
  • clicking the visible InputTransparent Entry: no alert and focus remains on the ScrollView pane;
  • clicking the second normal Entry: that Entry receives focus;
  • Tab: focus advances to the next Entry;
  • Shift+Tab: focus returns to the previous Entry.
issue-31039-after-fix-revised.mp4

The Windows Controls ScrollView device-test category also passes 11/11. Removing only ScrollViewer.IsTabStop = true makes exactly the new regression test fail.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 4 findings

See inline comments for details.

MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Aug 14, 2026

@kubaflo kubaflo 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.

Could you please check the ai's suggestions?

Replace the invisible ContentPanel tab stop with the native ScrollViewer and cover focus behavior with a Controls device test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bcd06486-88bb-4458-ad38-55bf1be162f5
Copilot AI review requested due to automatic review settings August 14, 2026 20:02

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.

Review details

Suppressed comments (1)

src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.Windows.cs:53

  • The lambda passed to AttachAndRun is marked async but doesn’t perform any asynchronous work (it ends with await Task.CompletedTask). This adds unnecessary async state machine overhead and makes the test harder to read. Consider making the callback synchronous and removing the redundant await Task.CompletedTask.
			await AttachAndRun<ScrollViewHandler>(scrollView, async handler =>
			{
				Assert.True(handler.PlatformView.IsTabStop);
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 14, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 5 findings

See inline comments for details.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 24, 2026
@MauiBot

This comment has been minimized.

@MauiBot

This comment has been minimized.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Aug 24, 2026
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 24, 2026
@kubaflo kubaflo removed the s/agent-review-in-progress AI review is currently running for this PR label Aug 24, 2026
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 24, 2026
@MauiBot

This comment has been minimized.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 4 findings

See inline comments for details.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@jfversluis — new AI review results are available based on commit 195f644.

Gate Passed Confidence Medium Platform Windows


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: WINDOWS · Base: main · Merge base: bd904afb

Test Without Fix (expect FAIL) With Fix (expect PASS)
📱 ScrollViewTests (EntryDoesNotReceiveFocusWhenWindowOpens, ShiftTabFromScrollViewerMovesToPreviousControl, ScrollViewerPreservesNativeTabStopDefaultAcrossHandlerLifecycle, ScrollViewerPreservesTabStopBindingAfterLoading, UnfocusPreservesTwoWayTabStopBinding, NativeTabStopWriteDuringLoadingWins, UnfocusDuringLoadingRestoresOriginalTabStopState, ExplicitEntryFocusDuringLoadingIsPreserved, ScrollViewerPreservesCustomTabStopValueAfterLoading, ScrollViewerPreservesCustomTrueTabStopValueAfterLoading, ScrollViewerPreservesStyledTabStopValueAfterLoading, EntryDoesNotReceiveFocusWhenScrollViewReloads, QueuedTabStopRestoreDoesNotRunAfterDisconnect, RemovingScrollViewDuringLoadingDoesNotStrandTemporaryTabStop) Category=ScrollView ✅ FAIL — 400s ✅ PASS — 312s
📱 EntryTests (UnfocusPreservesStyleOwnedTabStopState) Category=Entry ✅ FAIL — 313s ✅ PASS — 302s
🔴 Without fix — 📱 ScrollViewTests (EntryDoesNotReceiveFocusWhenWindowOpens, ShiftTabFromScrollViewerMovesToPreviousControl, ScrollViewerPreservesNativeTabStopDefaultAcrossHandlerLifecycle, ScrollViewerPreservesTabStopBindingAfterLoading, UnfocusPreservesTwoWayTabStopBinding, NativeTabStopWriteDuringLoadingWins, UnfocusDuringLoadingRestoresOriginalTabStopState, ExplicitEntryFocusDuringLoadingIsPreserved, ScrollViewerPreservesCustomTabStopValueAfterLoading, ScrollViewerPreservesCustomTrueTabStopValueAfterLoading, ScrollViewerPreservesStyledTabStopValueAfterLoading, EntryDoesNotReceiveFocusWhenScrollViewReloads, QueuedTabStopRestoreDoesNotRunAfterDisconnect, RemovingScrollViewDuringLoadingDoesNotStrandTemporaryTabStop): FAIL ✅ · 400s

(no coded error found; showing last 1200 chars)

s the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
Platform\Windows\TabbedPage\TabbedPageStyle.xaml(13,13): XamlCompiler warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
    0 Error(s)
Time Elapsed 00:05:08.47
  Passed: 9
  Failed: 5
  Skipped: 0
  Total: 14
  Tests completed with exit code: 1
🟢 With fix — 📱 ScrollViewTests (EntryDoesNotReceiveFocusWhenWindowOpens, ShiftTabFromScrollViewerMovesToPreviousControl, ScrollViewerPreservesNativeTabStopDefaultAcrossHandlerLifecycle, ScrollViewerPreservesTabStopBindingAfterLoading, UnfocusPreservesTwoWayTabStopBinding, NativeTabStopWriteDuringLoadingWins, UnfocusDuringLoadingRestoresOriginalTabStopState, ExplicitEntryFocusDuringLoadingIsPreserved, ScrollViewerPreservesCustomTabStopValueAfterLoading, ScrollViewerPreservesCustomTrueTabStopValueAfterLoading, ScrollViewerPreservesStyledTabStopValueAfterLoading, EntryDoesNotReceiveFocusWhenScrollViewReloads, QueuedTabStopRestoreDoesNotRunAfterDisconnect, RemovingScrollViewDuringLoadingDoesNotStrandTemporaryTabStop): PASS ✅ · 312s

(no coded error found; showing last 1200 chars)

press the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
Platform\Windows\TabbedPage\TabbedPageStyle.xaml(13,13): XamlCompiler warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
    0 Error(s)
Time Elapsed 00:04:55.39
  Passed: 14
  Failed: 0
  Skipped: 0
  Total: 14
  Tests completed successfully
🔴 Without fix — 📱 EntryTests (UnfocusPreservesStyleOwnedTabStopState): FAIL ✅ · 313s

(no coded error found; showing last 1200 chars)

ss the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
Platform\Windows\TabbedPage\TabbedPageStyle.xaml(13,13): XamlCompiler warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
    0 Error(s)
Time Elapsed 00:04:57.69
  Passed: 0
  Failed: 1
  Skipped: 0
  Total: 1
  Tests completed with exit code: 1
🟢 With fix — 📱 EntryTests (UnfocusPreservesStyleOwnedTabStopState): PASS ✅ · 302s

(no coded error found; showing last 1200 chars)

uppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
Platform\Windows\TabbedPage\TabbedPageStyle.xaml(13,13): XamlCompiler warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
    0 Error(s)
Time Elapsed 00:04:48.78
  Passed: 1
  Failed: 0
  Skipped: 0
  Total: 1
  Tests completed successfully
📁 Fix files reverted (2 files)
  • src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
  • src/Core/src/Platform/Windows/ViewExtensions.cs

📋 Pre-Flight — Context & Validation

PR #37428 Pre-Flight

Context

  • PR: [Windows] ScrollView: Prevent automatic Entry focus
  • Issue: #31039, MAUI Entry Gains Focus Automatically When Placed Inside ScrollView on Windows
  • Platform: Windows
  • Gate: Passed previously: the regression tests fail without the PR fix and pass with it. Do not rerun gate verification and do not touch gate/content.md.
  • Observed bug: WinUI's initial focus routing selects the first focusable descendant Entry when a MAUI ScrollView is loaded. This raises Focused without user input. Clicking an InputTransparent Entry can trigger the same undesired redirect.

Current PR approach

The current fix makes the native WinUI ScrollViewer a transient IsTabStop=true target during its Loading/Loaded window, then restores the exact binding/local/style/default ownership state. It uses an owned temporary binding, dispatcher-queued restoration, generation and platform-view identity guards, unload/disconnect cleanup, and a low-priority fallback for removal during loading. It also changes ViewExtensions.UnfocusControl so temporary unfocus preserves binding/local/style/default ownership and does not update a TwoWay source.

The PR explicitly rejects these already-tried or unsafe variants:

  • making the internal ContentPanel a tab stop;
  • leaving ScrollViewer.IsTabStop=true permanently;
  • setting AllowFocusOnInteraction=false;
  • restoring a hardcoded tab-stop value;
  • writing a temporary dependency-property value while a TwoWay binding remains attached;
  • using a normal-priority fallback from Loading;
  • canceling GettingFocus, which cannot distinguish automatic from legitimate programmatic focus.

Diff inspected

Compared materialized commit d86245aeaa37c4638bcfa6dc9416b68b3c9bc010 with its parent:

  • src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs (+128/-1): transient native ScrollViewer tab-stop lifecycle.
  • src/Core/src/Platform/Windows/ViewExtensions.cs (+12/-2): preserve IsTabStop ownership during unfocus.
  • src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.Windows.cs (+884, new): Windows focus, ownership, binding, navigation, lifecycle, and stale-callback coverage.
  • src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs (+46): style-owned IsTabStop unfocus regression.

No public API changes are present.

Test contract

Use only the repository device-test runner and these bounded Windows categories:

  1. Primary: pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "Category=ScrollView" -IncludeClasses "Microsoft.Maui.DeviceTests.ScrollViewTests"
  2. Mandatory regression: pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "Category=Entry" -IncludeClasses "Microsoft.Maui.DeviceTests.EntryTests"

Do not run a full test suite. Each candidate gets one implementation/test pass and at most one focused correction followed by one retest of the same bounded commands.

Workspace constraints

The checkout is pr-review-37428 at the squashed PR commit. The worktree already contains unrelated modified and untracked review-pipeline files under .github/ and eng/; they are pre-existing harness/user state and must not be edited, removed, or reverted. Follow the try-fix skill's baseline allow-list and script-only restoration rules exactly.


🔬 Code Review — Deep Analysis

Expert PR Evaluation

Verdict: NEEDS_DISCUSSION
Confidence: Medium

Independent assessment

The Windows ScrollViewHandler temporarily makes its native ScrollViewer a tab stop during WinUI's load-time focus pass, then restores the dependency property's prior binding, local, styled, or default ownership. The temporary binding doubles as an ownership token so later app or mapper writes win. Generation and platform-view identity checks prevent queued callbacks from mutating a disconnected or replaced handler. The shared Windows UnfocusControl path now detaches bindings before toggling IsTabStop, preserving binding identity and preventing TwoWay source mutation.

The approach is technically sound and unusually careful about WinUI dependency-property precedence, handler lifecycle, and stale callbacks. The submitted tests provide strong coverage across default/local/style/OneWay/TwoWay ownership, explicit focus, later native writes, disconnect/reconnect, reload, removal during loading, and keyboard navigation. The trusted Gate passed: the discriminating tests fail without the fix and pass with it.

Findings

  1. ⚠️ Warning — failed low-priority enqueue can strand the transient tab stop. QueueTemporaryTabStopRestore only restores synchronously when restoreWhenLoaded is true. If the Loading-path enqueue fails and no later Loaded, Unloaded, or disconnect callback arrives, the temporary binding can remain active and future Loading calls cannot recapture state. A synchronous fallback for either enqueue failure would preserve state, at the cost of reverting to pre-fix focus behavior for that load.
  2. 💡 Suggestion — low-priority scheduling is an implicit correctness dependency. If the Loading-queued callback runs while the element remains unloaded but before Loaded, it can restore too early; Loaded then sees no temporary state to restore. The existing empirical tests reduce this risk, but the ordering assumption is not expressed as a stronger lifecycle condition.
  3. 💡 Suggestion — assert transient binding removal for local values. The local-value tests verify effective and local values but not that the handler-owned temporary binding is detached.
  4. 💡 Suggestion — add a load-time negative focus case. Existing reverse-navigation coverage adds the preceding button after load. It does not prove a control preceding the ScrollView at initial load retains the intended focus, nor cover sibling ScrollViews.

Raw file-and-line findings are persisted in ../inline-findings.json.

Blast radius and failure modes

The behavior runs for every Windows MAUI ScrollView, including startup/page initialization. It adds no static state and all event subscriptions are removed during disconnect. The key residual risks are a stranded IsTabStop=true when dispatch fails, an early restore that silently reintroduces automatic Entry focus, and initial-focus/accessibility behavior on pages with another focusable control before the ScrollView. No crash, resource leak, public API change, or cross-platform behavior change was identified.

Narrative reconciliation

The submitted description accurately explains the root cause, transient binding ownership, generation guards, unload/disconnect cleanup, and UnfocusControl preservation behavior. It matches the raw submitted diff. No blocking defect was found, but the enqueue-failure path is actionable and the focus-order implications merit explicit resolution before treating the raw PR as the strongest candidate.


🛠️ Try-Fix — Analysis & Comparison

Alternative Fix Candidates for PR #37428

Candidate 1 - Animation-precedence IsTabStop override

Model: claude-opus-5
Attempt artifacts: CustomAgentLogsTmp/PRState/37428/PRAgent/try-fix/attempt-1
Detailed narrative: CustomAgentLogsTmp/PRState/37428/PRAgent/try-fix-1/content.md
Result: Pass
Self-review: 3 moderate findings; 0 critical or major

Approach and mechanism-level difference

The PR snapshots and replaces the application-owned IsTabStop value with a temporary binding, then reconstructs the binding/local/style/default state. This candidate instead applies IsTabStop through WinUI's higher-precedence animation value channel using a zero-length ObjectAnimationUsingKeyFrames and Storyboard. The underlying binding, local value, style, or default remains untouched; stopping the storyboard removes only the animation value and lets WinUI reveal the current underlying value. Token identity prevents stale queued callbacks from stopping a newer override.

The same primitive replaces ViewExtensions.UnfocusControl's binding/local-value preservation. Since the temporary false value is an animation value, it cannot replace a binding, create a durable local value, or push a value into a TwoWay source.

This avoids the current PR's value-slot arbitration and all explicitly rejected variants: a focusable ContentPanel, permanent ScrollViewer.IsTabStop=true, AllowFocusOnInteraction=false, hardcoded restoration, a temporary local write under a TwoWay binding, normal-priority loading fallback, and GettingFocus cancellation.

Files changed

  • src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs (+61/-0)
  • src/Core/src/Platform/Windows/ViewExtensions.cs (+67/-3)

No tests or public APIs changed.

Tests

  1. Primary Windows ScrollView category:
    pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "Category=ScrollView" -IncludeClasses "Microsoft.Maui.DeviceTests.ScrollViewTests"
    • Initial pass: 19 passed, 5 failed.
    • After the one allowed focused correction: 24 passed, 0 failed.
  2. Mandatory Windows Entry regression category:
    pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "Category=Entry" -IncludeClasses "Microsoft.Maui.DeviceTests.EntryTests"
    • 14 passed, 0 failed, 4 ignored.

No other test or build command ran.

Initial failure and correction

Storyboard.Begin() only scheduled the zero-duration animation, so its hold value was not active before WinUI's load-time focus pass. Five ScrollView tests failed, including the startup and reload focus tests. The single correction called SkipToFill() immediately after Begin(), synchronously advancing the animation clock to the fill period. All 24 ScrollView tests then passed.

Self-review findings

  1. Moderate: Begin()/SkipToFill() could be risky for a detached control, although UnfocusControl operates on a focused/attached control and direct storyboard targeting does not require namescope lookup.
  2. Moderate: Correctness relies on SkipToFill() applying synchronously, an animation-clock behavior covered empirically by the device tests.
  3. Moderate: The low-priority loading fallback could theoretically run between Loading and Loaded; normal priority is known to restore too early, while unload/disconnect cleanup prevents a stranded override.

Captured diff

diff --git a/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs b/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
index 333003de03..d941120ea7 100644
--- a/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
+++ b/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
@@ -8,6 +8,7 @@ using Microsoft.UI.Xaml;
 using Microsoft.UI.Xaml.Controls;
 using Windows.UI.Core;
 using static Microsoft.Maui.Layouts.LayoutExtensions;
+using PlatformViewExtensions = Microsoft.Maui.Platform.ViewExtensions;
 
 namespace Microsoft.Maui.Handlers
 {
@@ -15,6 +16,10 @@ namespace Microsoft.Maui.Handlers
 	{
 		const string ContentPanelTag = "MAUIScrollViewContentPanel";
 
+		// Token for the temporary IsTabStop animation override applied while WinUI runs
+		// its load-time focus pass.
+		object? _tabStopOverrideToken;
+
 		// Stores a scroll request that arrived before the content was laid out.
 		internal ScrollToRequest? PendingScrollToRequest { get; private set; }
 
@@ -36,6 +41,9 @@ namespace Microsoft.Maui.Handlers
 		protected override void ConnectHandler(ScrollViewer platformView)
 		{
 			base.ConnectHandler(platformView);
+			platformView.Loading += OnPlatformViewLoading;
+			platformView.Loaded += OnPlatformViewLoaded;
+			platformView.Unloaded += OnPlatformViewUnloaded;
 			platformView.ViewChanged += ViewChanged;
 		}
 
@@ -47,6 +55,10 @@ namespace Microsoft.Maui.Handlers
 			// causing a WinUI COM exception "Element already has a parent" (Issue #35277).
 			// Cascading here ensures ToPlatform() creates a fresh native view with no parent.
 			VirtualView?.PresentedContent?.Handler?.DisconnectHandler();
+			platformView.Loading -= OnPlatformViewLoading;
+			platformView.Loaded -= OnPlatformViewLoaded;
+			platformView.Unloaded -= OnPlatformViewUnloaded;
+			ClearTabStopOverride(platformView);
 			base.DisconnectHandler(platformView);
 			platformView.ViewChanged -= ViewChanged;
 
@@ -62,6 +74,55 @@ namespace Microsoft.Maui.Handlers
 			}
 		}
 
+		void OnPlatformViewLoading(FrameworkElement sender, object args)
+		{
+			var scrollViewer = (ScrollViewer)sender;
+
+			_tabStopOverrideToken = PlatformViewExtensions.ApplyTabStopOverride(scrollViewer, true);
+
+			// Low priority keeps this safety net behind WinUI's load focus pass.
+			QueueClearTabStopOverride(scrollViewer, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low);
+		}
+
+		void OnPlatformViewLoaded(object sender, RoutedEventArgs e)
+		{
+			// Keep the override until the dispatcher turn after Loaded.
+			QueueClearTabStopOverride((ScrollViewer)sender, Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal);
+		}
+
+		void OnPlatformViewUnloaded(object sender, RoutedEventArgs e) =>
+			ClearTabStopOverride((ScrollViewer)sender);
+
+		void QueueClearTabStopOverride(ScrollViewer scrollViewer, Microsoft.UI.Dispatching.DispatcherQueuePriority priority)
+		{
+			var token = _tabStopOverrideToken;
+			if (token is null)
+				return;
+
+			if (scrollViewer.DispatcherQueue?.TryEnqueue(priority, () => ClearTabStopOverride(scrollViewer, token)) != true &&
+				priority == Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal)
+			{
+				ClearTabStopOverride(scrollViewer, token);
+			}
+		}
+
+		void ClearTabStopOverride(ScrollViewer scrollViewer, object? token = null)
+		{
+			PlatformViewExtensions.ClearTabStopOverride(scrollViewer, token);
+
+			if (token is null || ReferenceEquals(token, _tabStopOverrideToken))
+				_tabStopOverrideToken = null;
+		}
+
 		void OnContentPanelSizeChanged(object sender, SizeChangedEventArgs e)
 		{
 			((FrameworkElement)sender).SizeChanged -= OnContentPanelSizeChanged;
diff --git a/src/Core/src/Platform/Windows/ViewExtensions.cs b/src/Core/src/Platform/Windows/ViewExtensions.cs
index 18fea5a6b1..67de5b3866 100644
--- a/src/Core/src/Platform/Windows/ViewExtensions.cs
+++ b/src/Core/src/Platform/Windows/ViewExtensions.cs
@@ -2,6 +2,7 @@
 using System;
 using System.Linq;
 using System.Numerics;
+using System.Runtime.CompilerServices;
 using System.Threading.Tasks;
 using Microsoft.Maui.Devices;
 using Microsoft.Maui.Graphics;
@@ -12,6 +13,7 @@ using Microsoft.UI.Xaml.Automation;
 using Microsoft.UI.Xaml.Controls;
 using Microsoft.UI.Xaml.Input;
 using Microsoft.UI.Xaml.Media;
+using Animation = Microsoft.UI.Xaml.Media.Animation;
 using WFlowDirection = Microsoft.UI.Xaml.FlowDirection;
 using WinPoint = Windows.Foundation.Point;
 
@@ -391,6 +393,65 @@ namespace Microsoft.Maui.Platform
 			return VisualTreeHelper.GetChild(view, index) as T;
 		}
 
+		static readonly ConditionalWeakTable<Control, Animation.Storyboard> TabStopOverrides = new();
+
+		internal static object? ApplyTabStopOverride(this Control control, bool value)
+		{
+			control.ClearTabStopOverride();
+
+			var animation = new Animation.ObjectAnimationUsingKeyFrames();
+			animation.KeyFrames.Add(new Animation.DiscreteObjectKeyFrame
+			{
+				KeyTime = TimeSpan.Zero,
+				Value = value
+			});
+
+			Animation.Storyboard.SetTarget(animation, control);
+			Animation.Storyboard.SetTargetProperty(animation, nameof(Control.IsTabStop));
+
+			var storyboard = new Animation.Storyboard();
+			storyboard.Children.Add(animation);
+
+			TabStopOverrides.Add(control, storyboard);
+			storyboard.Begin();
+			storyboard.SkipToFill();
+
+			return storyboard;
+		}
+
+		internal static void ClearTabStopOverride(this Control control, object? token = null)
+		{
+			if (!TabStopOverrides.TryGetValue(control, out var storyboard))
+				return;
+
+			if (token is not null && !ReferenceEquals(token, storyboard))
+				return;
+
+			TabStopOverrides.Remove(control);
+			storyboard.Stop();
+		}
+
 		internal static void UnfocusControl(Control control)
 		{
 			if (!control.IsEnabled)
@@ -398,11 +459,14 @@ namespace Microsoft.Maui.Platform
 				return;
 			}
 
-			var isTabStop = control.IsTabStop;
-			control.IsTabStop = false;
+			var token = control.ApplyTabStopOverride(false);
 			control.IsEnabled = false;
 			control.IsEnabled = true;
-			control.IsTabStop = isTabStop;
+			control.ClearTabStopOverride(token);
 		}

Candidate 2 - Proactive focus parking with a temporary style overlay

Model: gpt-5.6-sol
Attempt artifacts: CustomAgentLogsTmp/PRState/37428/PRAgent/try-fix/attempt-2
Detailed narrative: CustomAgentLogsTmp/PRState/37428/PRAgent/try-fix-2/content.md
Result: Fail
Self-review: 3 major findings; 0 critical or moderate/minor

Approach and mechanism-level difference

During ScrollViewer.Loading, this candidate applied an exact-identity temporary Style containing IsTabStop=true only when neither Style nor IsTabStop had an app-owned local value or binding. For app-owned false values, it queued programmatic focus on the ScrollViewer. The style overlay was removed after Loaded, and ViewExtensions.UnfocusControl attempted to park focus on XamlRoot.Content while the target was disabled.

This used neither the PR's state capture/reconstruction nor candidate 1's animation precedence. Direct focus was intended to preempt WinUI's descendant search, while the lower-precedence style allowed later local writes to win naturally. Exact-style identity guarded cleanup. It also avoided every rejected pre-flight variant.

Files changed

  • src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs: temporary style overlay, focus scheduling, lifecycle cleanup.
  • src/Core/src/Platform/Windows/ViewExtensions.cs: root focus parking.

No tests or public APIs changed.

Tests

Primary command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter "Category=ScrollView" -IncludeClasses "Microsoft.Maui.DeviceTests.ScrollViewTests"

  • Initial pass: 21 passed, 3 failed.
  • After the one allowed focused correction: 21 passed, 3 failed, with the same failures:
    • ExplicitEntryFocusDuringLoadingIsPreserved
    • UnfocusPreservesTwoWayTabStopBinding
    • ScrollViewerPreservesCustomTabStopValueAfterLoading

The conditional Entry regression category was not run because the primary category failed. No other test or build command ran.

Failure analysis and self-review

The default-state overlay kept the ScrollViewer eligible long enough to displace a legitimate explicit Entry.Focus() during loading. When an app-owned IsTabStop=false prevented the overlay, queued programmatic focus did not suppress WinUI's later automatic descendant search. During unfocus, focusing XamlRoot.Content routed focus back to the ScrollViewer after re-enable rather than acting as a neutral sink. The focused correction moved focus to a normal-priority pre-Loaded callback and attempted root focus while disabled, but all three failures repeated.

The inline self-review recorded those same three concrete scenarios as major findings. The unchanged failure set after correction establishes that proactive focus parking plus a style overlay is not viable under the bounded contract.

Captured diff

diff --git a/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs b/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
index 333003de03..3b5b7dd58d 100644
--- a/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
+++ b/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs
@@ -14,6 +14,8 @@ namespace Microsoft.Maui.Handlers
 	public partial class ScrollViewHandler : ViewHandler<IScrollView, ScrollViewer>, ICrossPlatformLayout
 	{
 		const string ContentPanelTag = "MAUIScrollViewContentPanel";
+		ScrollViewer? _tabStopPlatformView;
+		Style? _temporaryTabStopStyle;
 
 		// Stores a scroll request that arrived before the content was laid out.
 		internal ScrollToRequest? PendingScrollToRequest { get; private set; }
@@ -36,7 +38,10 @@ namespace Microsoft.Maui.Handlers
 		protected override void ConnectHandler(ScrollViewer platformView)
 		{
 			base.ConnectHandler(platformView);
+			platformView.Loading += OnPlatformViewLoading;
+			platformView.Unloaded += OnPlatformViewUnloaded;
 			platformView.ViewChanged += ViewChanged;
+			_tabStopPlatformView = platformView;
 		}
 
 		protected override void DisconnectHandler(ScrollViewer platformView)
@@ -47,8 +52,13 @@ namespace Microsoft.Maui.Handlers
 			// causing a WinUI COM exception "Element already has a parent" (Issue #35277).
 			// Cascading here ensures ToPlatform() creates a fresh native view with no parent.
 			VirtualView?.PresentedContent?.Handler?.DisconnectHandler();
-			base.DisconnectHandler(platformView);
+			platformView.Loading -= OnPlatformViewLoading;
+			platformView.Loaded -= OnPlatformViewLoaded;
+			platformView.Unloaded -= OnPlatformViewUnloaded;
 			platformView.ViewChanged -= ViewChanged;
+			ClearTemporaryTabStopStyle(platformView);
+			_tabStopPlatformView = null;
+			base.DisconnectHandler(platformView);
 
 			if (PendingScrollToRequest is not null)
 			{
@@ -62,6 +72,100 @@ namespace Microsoft.Maui.Handlers
 			}
 		}
 
+		void OnPlatformViewLoading(FrameworkElement sender, object args)
+		{
+			var scrollViewer = (ScrollViewer)sender;
+			if (!ReferenceEquals(_tabStopPlatformView, scrollViewer))
+				return;
+
+			ClearTemporaryTabStopStyle(scrollViewer);
+
+			if (scrollViewer.ReadLocalValue(FrameworkElement.StyleProperty) == DependencyProperty.UnsetValue &&
+				scrollViewer.ReadLocalValue(Control.IsTabStopProperty) == DependencyProperty.UnsetValue)
+			{
+				var temporaryStyle = new Style(typeof(ScrollViewer))
+				{
+					BasedOn = scrollViewer.Style
+				};
+				temporaryStyle.Setters.Add(new Setter
+				{
+					Property = Control.IsTabStopProperty,
+					Value = true
+				});
+
+				_temporaryTabStopStyle = temporaryStyle;
+				scrollViewer.Style = temporaryStyle;
+			}
+
+			scrollViewer.Loaded -= OnPlatformViewLoaded;
+			scrollViewer.Loaded += OnPlatformViewLoaded;
+
+			var temporaryStyleToken = _temporaryTabStopStyle;
+			var moveFocusProgrammatically = !scrollViewer.IsTabStop;
+			if (scrollViewer.DispatcherQueue?.TryEnqueue(() =>
+			{
+				if (scrollViewer.IsLoaded)
+					return;
+
+				if (Microsoft.UI.Xaml.Media.VisualTreeHelper.GetParent(scrollViewer) is null)
+				{
+					scrollViewer.Loaded -= OnPlatformViewLoaded;
+					ClearTemporaryTabStopStyle(scrollViewer, temporaryStyleToken);
+					return;
+				}
+
+				if (moveFocusProgrammatically)
+					scrollViewer.Focus(FocusState.Programmatic);
+			}) != true && moveFocusProgrammatically)
+			{
+				scrollViewer.Focus(FocusState.Programmatic);
+			}
+		}
+
+		void OnPlatformViewLoaded(object sender, RoutedEventArgs e)
+		{
+			var scrollViewer = (ScrollViewer)sender;
+			scrollViewer.Loaded -= OnPlatformViewLoaded;
+
+			var temporaryStyleToken = _temporaryTabStopStyle;
+			if (scrollViewer.DispatcherQueue?.TryEnqueue(
+				() => ClearTemporaryTabStopStyle(scrollViewer, temporaryStyleToken)) != true)
+			{
+				ClearTemporaryTabStopStyle(scrollViewer, temporaryStyleToken);
+			}
+		}
+
+		void OnPlatformViewUnloaded(object sender, RoutedEventArgs e)
+		{
+			var scrollViewer = (ScrollViewer)sender;
+			scrollViewer.Loaded -= OnPlatformViewLoaded;
+			ClearTemporaryTabStopStyle(scrollViewer);
+		}
+
+		void ClearTemporaryTabStopStyle(ScrollViewer scrollViewer, Style? temporaryStyleToken = null)
+		{
+			if (_temporaryTabStopStyle is not { } temporaryStyle ||
+				(temporaryStyleToken is not null && !ReferenceEquals(temporaryStyleToken, temporaryStyle)))
+			{
+				return;
+			}
+
+			_temporaryTabStopStyle = null;
+			if (ReferenceEquals(
+				scrollViewer.ReadLocalValue(FrameworkElement.StyleProperty),
+				temporaryStyle))
+			{
+				scrollViewer.ClearValue(FrameworkElement.StyleProperty);
+			}
+		}
+
 		void OnContentPanelSizeChanged(object sender, SizeChangedEventArgs e)
 		{
 			((FrameworkElement)sender).SizeChanged -= OnContentPanelSizeChanged;
diff --git a/src/Core/src/Platform/Windows/ViewExtensions.cs b/src/Core/src/Platform/Windows/ViewExtensions.cs
index 18fea5a6b1..9d89cc8444 100644
--- a/src/Core/src/Platform/Windows/ViewExtensions.cs
+++ b/src/Core/src/Platform/Windows/ViewExtensions.cs
@@ -398,11 +398,18 @@ namespace Microsoft.Maui.Platform
 				return;
 			}
 
-			var isTabStop = control.IsTabStop;
-			control.IsTabStop = false;
+			if (control.FocusState == FocusState.Unfocused)
+				return;
+
 			control.IsEnabled = false;
+			if (control.XamlRoot?.Content is UIElement focusRoot &&
+				!ReferenceEquals(focusRoot, control))
+			{
+				focusRoot.Focus(FocusState.Programmatic);
+			}
 			control.IsEnabled = true;
-			control.IsTabStop = isTabStop;
 		}

🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Winner: pr-plus-reviewer

The submitted fix is fundamentally sound and the trusted Gate proves that its regression tests fail without the fix and pass with it. The expert review nevertheless found that the Loading fail-safe could restore too early when the element was still parented, while an enqueue failure could leave the handler-owned temporary binding active indefinitely. pr-plus-reviewer preserves the submitted design, closes both lifecycle gaps, adds discriminating ownership and initial-focus coverage, and passes both required Windows test commands.

Comparative ranking

Rank Candidate Validation Assessment
1 pr-plus-reviewer PASS — ScrollView 25/25; Entry 14/14 with 4 ignored Best balance of correctness and evidence. It retains the PR's tested dependency-property ownership model, makes the removal fallback depend on actual visual-tree removal, restores safely if dispatch fails, verifies temporary binding removal, and proves a preceding focusable control is not displaced at startup.
2 pr PASS — trusted Gate; ScrollView 24/24 and Entry 14/14 with 4 ignored in the submitted validation Correct core mechanism with broad lifecycle and ownership coverage, but the expert review identified an enqueue-failure state leak and an avoidable scheduling-order ambiguity. Those issues are resolved by the winner.
3 try-fix-1 PASS — ScrollView 24/24; Entry 14/14 with 4 ignored The animation-precedence approach avoids reconstructing the app-owned value slot, but introduces a static ConditionalWeakTable, Storyboard lifecycle/exception surface, and dependence on Begin()/SkipToFill() animation-clock behavior. It retains the same low-priority timing concern and has less direct expert evidence than the refined PR design.
4 try-fix-2 FAIL — ScrollView 21/24; Entry not run Ranked last as required because it failed regressions. It displaced legitimate explicit Entry focus, did not suppress automatic descendant focus for app-owned IsTabStop=false, and routed unfocus back to the ScrollViewer.

Expert review disposition

  • Resolved in the winner: failed TryEnqueue cleanup, premature low-priority restore while the ScrollViewer remains parented, missing transient-binding assertions, and the missing preceding-control load-time negative case.
  • Accepted residual risk: WinUI event/dispatcher ordering remains platform behavior that cannot be exhaustively proven by deterministic tests; generation, platform-view identity, visual-parent, loaded-state, unload, and disconnect guards constrain it.
  • No blocking issue found: no public API change, cross-platform behavior change, static state, subscription leak, or stale-callback mutation was identified.

Because the winning refinement is not present in submitted HEAD, the PR should be updated before approval.


📱 UI Tests — ViewBaseTests

Detected UI test categories: ViewBaseTests

[!WARNING]
No UI test results were produced for the detected categories. The PR build itself was
fine — the deep UI stage was skipped or interrupted on infrastructure (the
merge-for-testing step, emulator/simulator boot, or an Appium hang), not by this PR's code.
This is usually transient; the review re-runs on new commits (a maintainer can also re-run it).


🧭 Next Steps — reviewer changes required

The reviewer-enhanced candidate identified changes that are not yet in the submitted PR.

Why: The refined PR preserves the submitted fix's proven dependency-property ownership model while closing the expert review's enqueue-failure and premature-restore gaps. It passed all 25 targeted ScrollView tests and all 14 runnable Entry tests, including the new load-time negative focus case.

Address the actionable findings in this review before merging.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Aug 24, 2026
@kubaflo

kubaflo commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@kubaflo kubaflo 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.

Could you please check the ai's suggestions?

Add discriminating coverage for transient tab-stop ordering, negative startup focus, and binding/style ownership restoration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bcd06486-88bb-4458-ad38-55bf1be162f5
Copilot AI review requested due to automatic review settings August 27, 2026 08:41

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.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@kubaflo
kubaflo changed the base branch from main to inflight/current August 27, 2026 14:25
@kubaflo
kubaflo merged commit 25c5280 into inflight/current Aug 27, 2026
36 checks passed
@kubaflo
kubaflo deleted the jfversluis-fix-entry-focus-windows branch August 27, 2026 14:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MAUI Entry Gains Focus Automatically When Placed Inside ScrollView on Windows

4 participants