Skip to content

[Shell] TabBar/ShellContent AutomationId Should Expose - #39406

Merged
kubaflo merged 13 commits into
dotnet:candidate/11.0.1xx-sr2from
SubhikshaSf4851:Fix-39055
Nov 12, 2026
Merged

kubaflo merged 13 commits into
dotnet:candidate/11.0.1xx-sr2from
SubhikshaSf4851:Fix-39055

Conversation

@SubhikshaSf4851

@SubhikshaSf4851 SubhikshaSf4851 commented Oct 15, 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!

This pull request enhances accessibility across Android, iOS, and Windows by ensuring that AutomationId properties are properly set and propagated for TabBar and its items in Shell-based navigation. This allows for improved UI testing and accessibility tool support. The changes also introduce new test cases to verify this behavior and update templates and view models to support the new properties.

Accessibility Improvements for TabBar and Tabs:

  • Android:

    • Sets AutomationId as an accessibility identifier for the TabBar and each tab item using a custom accessibility delegate, ensuring the IDs are correctly exposed to accessibility services and UI tests. [1] [2] [3]
    • Updates the bottom sheet dialog for overflow tabs to set AutomationId for each tab row. [1] [2]
  • iOS:

    • Assigns AutomationId to the TabBar and each tab's UITabBarItem.AccessibilityIdentifier, including handling for overflow menu items and current tab changes. [1] [2] [3] [4]
  • Windows:

    • Maps AutomationId and accessibility view properties to the TabBar and its items, updating the NavigationViewItemViewModel and XAML templates to bind these properties. [1] [2] [3] [4] [5] [6] [7]
    • Ensures these properties are updated in response to property changes and when creating platform elements. [1] [2]

Testing and Verification:

  • New Test Case:
    • Adds a new issue test (Issue39055) to verify that AutomationId is correctly set for the TabBar and each tab, with platform-specific coverage and UI test assertions. [1] [2]

Other Updates:

  • Updates an existing test to use the new AutomationId for tab selection on Windows.

These changes collectively ensure that the TabBar and its items are accessible and easily identifiable in UI automation scenarios across all supported platforms.

Issues Fixed

Fixes #39055

  • Windows
  • Android
  • iOS
  • Mac
Before Issue Fix After Issue Fix
BeforeFix39055 AfterFix39055

@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 -- 39406

Or

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

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Oct 15, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@azure-pipelines

This comment has been minimized.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 15, 2026
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@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 Oct 15, 2026
@azure-pipelines

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@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 — 2 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

@SubhikshaSf4851 — new AI review results are available based on commit 0301d5f.

Gate Passed Confidence Low Platform Windows


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

Gate Result: ✅ PASSED

Platform: WINDOWS · Base: main · Merge base: 40173e06

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue39055 Issue39055 ✅ FAIL — 643s ✅ PASS — 502s
🔴 Without fix — 🖥️ Issue39055: FAIL ✅ · 643s

Error-relevant lines (filtered from the build log):

     at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2790
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2817
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 826
   at Microsoft.Maui.TestCases.Tests.Issues.Issue39055.Issue39055TabBarAutomationIdShouldBeSet() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39055.cs:line 19
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
🟢 With fix — 🖥️ Issue39055: PASS ✅ · 502s

(no coded error found; showing last 1200 chars)

st version 18.0.2 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 10/15/2026 2:57:22 PM FixtureSetup for Issue39055(Windows)
>>>>> 10/15/2026 2:57:29 PM Issue39055TabBarAutomationIdShouldBeSet Start
>>>>> 10/15/2026 2:57:32 PM Issue39055TabBarAutomationIdShouldBeSet Stop
  Passed Issue39055TabBarAutomationIdShouldBeSet [2 s]
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.13)
[xUnit.net 00:00:00.11]   Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.37]   Discovered:  Controls.TestCases.WinUI.Tests
Results File: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue39055.trx
Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 21.1051 Seconds
>>> TRX_RESULT_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue39055.trx
📁 Fix files reverted (7 files)
  • src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs
  • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs
  • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
  • src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
  • src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs
  • src/Controls/src/Core/Platform/Windows/TabbedPage/TabbedPageStyle.xaml
  • src/Core/src/Platform/Windows/NavigationViewItemViewModel.cs

📋 Pre-Flight — Context & Validation

Pre-Flight Context

Scope and provenance: Context only for draft PR #39406, titled [WIP] [Shell] TabBar/ShellContent AutomationId Should Expose. The immutable submitted diff targets main at 40173e061d2e976dca48eaaa13f6e0ada59e395a; submitted head is 0301d5f5c5425d14772e216fdeada87b50b00698. PR metadata reports 9 changed files, 180 additions, and 6 deletions. The PR is open, draft, and currently marked blocked. No conclusion or exhaustive code assessment is included here.

Reported problem

Linked issue #39055 reports that Shell TabBar and ShellContent automation identifiers are not exposed through native UI-automation attributes:

  • Android BottomNavigationView tab items lack a resource-id.
  • iOS UITabBarItem instances lack an accessibilityIdentifier.
  • The native tab bar itself also lacks an identifier.
  • Tests must therefore locate tabs by localized titles, which are unstable.
  • Expected behavior includes discoverable IDs for the tab bar and each tab, plus preservation of the native selected state.

The report names .NET MAUI 10.0.100, .NET SDK 10.0.200, Android API 24, iOS 17, and Appium 3.5.1. A validation comment reports reproduction with MAUI 10.0.0 and 10.0.110 on Android and iOS and attaches a ZIP; that attachment was not inspected. The issue separately lists Android 25+ and iOS 17+ as affected, so the exact Android lower bound is uncertain.

Historical issue #19328 described the same Android Shell/Appium discoverability problem and was closed as a duplicate of still-open #3996, which covers AutomationId support for Android TabbedPage/Shell.

Changed mechanism and files

  • Android Shell tab bar

    • src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs
      • Calls a new UpdateTabBarAutomationIds() after menu setup.
      • Assigns ShellItem.AutomationId to the native BottomNavigationView.
      • Assigns each ShellSection.CurrentItem?.AutomationId to the corresponding native menu-item view.
      • Adds an AccessibilityDelegateCompat that writes AccessibilityNodeInfoCompat.ViewIdResourceName as <package>:id/<AutomationId>.
      • Supplies automation IDs to rows in the overflow “More” sheet.
    • src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs
      • Extends the internal overflow-sheet factory with an optional callback receiving each row view and original item index.
      • Invokes that callback while constructing overflow rows; existing callers can omit it.
  • iOS and Mac Catalyst compatibility renderer

    • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs
      • Sets the native UITabBar.AccessibilityIdentifier from ShellItem.AutomationId when the Shell item is attached.
    • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
      • Changes tab-item identifier selection from ShellSection.AutomationId ?? Title to ShellSection.AutomationId ?? ShellSection.CurrentItem?.AutomationId ?? Title.
      • Because these .iOS.cs sources also compile for Mac Catalyst, this is the mechanism behind the PR body’s Mac claim; there is no separate Mac Catalyst implementation in the diff.
  • Windows Shell handler

    • src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
      • Applies existing Windows automation-property mapping to the root MauiNavigationView.
      • Copies each mapped BaseShellItem.AutomationId into its navigation-item view model.
      • Maps AutomationProperties.IsInAccessibleTree == false to WinUI AccessibilityView.Raw; true or unset maps to Content.
      • Reapplies the root navigation view’s automation ID during menu remapping.
    • src/Core/src/Platform/Windows/NavigationViewItemViewModel.cs
      • Adds observable AutomationId and AccessibilityView properties.
    • src/Controls/src/Core/Platform/Windows/TabbedPage/TabbedPageStyle.xaml
      • Binds those properties onto each native NavigationViewItem.
    • Existing Windows helper source confirms that SetAutomationProperties maps automation ID, accessible name, help text, labelled-by, and accessibility-tree visibility, while SetAutomationPropertiesAutomationId directly sets WinUI’s native automation-ID property.
  • UI-test coverage

    • src/Controls/tests/TestCases.HostApp/Issues/Issue39055.cs
      • Adds a Shell scenario containing a TabBar with ID main_tab_bar and three ShellContent IDs: tab_home, tab_browse, and tab_settings.
      • Marks the issue scenario as affecting all platforms.
    • src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39055.cs
      • Adds an Appium/NUnit Shell-category test that waits for all four identifiers.

No public API files are changed; the new Windows view-model members and Android factory parameter are on internal implementation types/methods.

Platform-sensitive paths

  • Windows is the designated validation platform. The relevant route is Shell item mapping → NavigationViewItemViewModel → XAML-bound WinUI NavigationViewItem, with the root ID placed on MauiNavigationView.
  • Android has two distinct native paths: directly visible bottom-navigation items and overflow rows created only after selecting “More.” Index correspondence around MaxItemCount, the synthetic “More” item, implicit Shell sections, and reordered collections is therefore significant.
  • iOS/Mac Catalyst identifiers are assigned through compatibility renderer lifecycle methods. Tab-item precedence favors an explicit ShellSection.AutomationId, then its current ShellContent.AutomationId, then the title.
  • Shell structure affects source IDs. Android explicitly reads ShellSection.CurrentItem; iOS has a section/current-item fallback chain; Windows uses whichever BaseShellItem the existing implicit/explicit Shell mapping places in the navigation view model.

Validation evidence and requirements

  • Provided Gate result: Gate ✅ PASSED — tests fail without the fix and pass with the fix. The Gate was not rerun.
  • Required platform: Windows.
  • The added test verifies Appium discoverability of the root tab bar and three tab IDs. It does not interact with the tabs or assert the exact native property value.
  • The issue’s selected-state expectation is not explicitly asserted by the new test.
  • The added test uses three tabs, so it does not exercise Android’s overflow “More” path.
  • Supporting the PR body’s cross-platform claim would separately require Android, iOS, and Mac Catalyst evidence; no such execution evidence was provided here.
  • Relevant preservation cases include explicit versus implicit Shell sections, nested/multiple ShellContent items, IsInAccessibleTree=false on Windows, menu reconstruction, and runtime changes to automation IDs.

Remaining uncertainties

  • Whether runtime changes to AutomationId are propagated consistently after initial renderer/handler setup is unknown; the new test assigns IDs only during construction.
  • Whether clearing or replacing an ID removes a previously installed Android accessibility delegate is not established by the submitted test.
  • Android visible-item and overflow-item index alignment, particularly the native synthetic “More” entry, remains to be validated.
  • Exact behavior for IDs containing characters that are unusual in Android resource names is unknown.
  • The test does not establish that Android exposes the exact package-qualified resource-id, only that Appium can locate the supplied identifier.
  • The PR expands behavior to Windows even though #39055 identifies Android and iOS as affected; the original Windows failure mode and expected native hierarchy are not documented in the issue.
  • Mac Catalyst behavior is inferred from shared iOS source compilation, not from Mac-specific evidence.
  • The attached issue reproduction and PR screenshots were not inspected.
  • Full CI results, build/type-check status, native hierarchy dumps, and dedicated expert findings are unknown. PR comments available during context gathering only showed automation notices and pipeline/review commands, not substantive implementation discussion.

🔬 Code Review — Deep Analysis

Code Review — PR #39406

Independent Assessment

What this changes: The PR wires Shell TabBar and tab item automation IDs into native platform surfaces across Android (BottomNavigationView + More sheet rows), iOS/MacCatalyst (UITabBar + UITabBarItem identifiers), and Windows (NavigationView + NavigationViewItem template bindings), and adds a UI test for tab/discoverability IDs.

Inferred motivation: Fix issue #39055 so Appium/accessibility tooling can locate TabBar and tab items by stable IDs instead of localized text.

Reconciliation with PR Narrative

Author claims: Cross-platform AutomationId propagation for TabBar/ShellContent and test coverage for the behavior.

Agreement/disagreement: The implementation broadly matches the claim. However, one Android lifecycle/state-transition gap remains: delegates are set for non-empty IDs but not cleared when IDs are absent, which can leave stale native IDs on reused tab views after remap. Also, added test coverage does not exercise the newly-added Android overflow (“More”) path.

Prior Review Reconciliation

No prior ❌ Error findings found across top-level reviews, inline comments, or issue-comment review surfaces.

Blast Radius Assessment

  • Runs for all instances: Yes (Shell TabBar rendering and remapping paths).
  • Startup impact: No direct startup path, but executes during Shell page initialization/navigation.
  • Static/shared state: No new static mutable state; behavior is per-handler/per-renderer.

CI Status

  • Required-check result: pending/undetermined.
  • Classification: undetermined (authenticated gh pr checks --required unavailable in this environment; anonymous commit check-runs show multiple in-progress jobs and no complete required-set verdict).
  • Action taken: capped confidence and non-LGTM verdict.

Findings

❌ Error — Android tab view can retain stale AutomationId after remap

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs:568

UpdateTabBarAutomationIds() skips items with empty AutomationId (continue) but never clears a previously attached accessibility delegate for that native item view. During SetupMenu() remaps (triggered by items/title/icon changes), native bottom-nav item views can be reused while Shell item ordering/identity changes. In that state, a reused view with now-empty AutomationId can still expose the previous ViewIdResourceName, causing Appium lookup to target the wrong tab.

⚠️ Warning — Regression test misses newly added Android overflow path

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39055.cs:20

The new test verifies IDs for a 3-tab fixture only, so it does not execute the overflow branch added by this PR (CreateMoreBottomSheet(..., setAutomationId) and callback wiring for “More” items). The Android change adds behavior in that path, but no regression test validates it with >5 tabs.

Failure-Mode Probing

  • What happens on Shell item remap when some tabs no longer have AutomationId? Existing native tab views may be reused; because the code only sets delegates for non-empty IDs and never clears delegates for empty IDs, stale IDs can persist.
  • What happens for overflow tabs (“More”) after this change? Callback-based delegate assignment is present, but current test fixture never enters overflow, so behavior is unverified by PR tests.
  • What happens when handlers disconnect/reconnect (Shell navigation/tab switch)? No new persistent global state is introduced; Windows/iOS assignments are idempotent per mapping/setup path, but Android stale delegate state across remap remains unresolved.

External Output Contract

Not applicable (this PR does not add or change regex/string classification of external tool/CI output).

Verdict: NEEDS_CHANGES

Confidence: low

Summary: The PR correctly addresses the main cross-platform AutomationId propagation objective, but it introduces an Android correctness gap where stale accessibility delegates can survive tab remapping and expose incorrect IDs. Test coverage also misses the newly-added Android overflow code path. CI required-check status is still undetermined/pending in this environment, so approval is not appropriate.

Concrete Reviewer-Refinement Trigger

Yes — evidence threshold met.

  • Source evidence: ShellItemRenderer.cs:568 (if (string.IsNullOrEmpty(automationId)) continue;) and surrounding code only sets delegates, never clears them on empty IDs.
  • State-transition evidence: SetupMenu() is invoked from shell item/section changes and remaps menu items; native views are re-bound via FindViewById(menuItem.ItemId).
  • Test evidence gap: Issue39055 UI test uses exactly three tabs and therefore cannot validate the new Android overflow branch introduced in BottomNavigationViewUtils.CreateMoreBottomSheet(... setAutomationId ...).

🛠️ Try-Fix — Analysis & Comparison

Alternative generation: not requested

Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.


📝 PR Finalize — Recommended Title & Description

Assessment: ✏️ Recommend updating — the current title contains a WIP marker and is grammatically vague, while the description overstates cross-platform verification and does not clearly state the native-mapping root cause.

Recommended title

[Android/iOS/MacCatalyst/Windows] Shell: Expose TabBar and ShellContent AutomationId

Recommended description

### Description of Change

.NET MAUI Shell did not consistently map managed `AutomationId` values from `TabBar`, `ShellSection`, and `ShellContent` to native automation attributes. Automation clients therefore had to locate tabs by localized titles instead of stable identifiers.

This change adds the native mappings across Shell's platform implementations:

* **Android**
  - `ShellItemRenderer` assigns the `TabBar` and visible tab-item IDs through `AutomationIdAccessibilityDelegate`, which exposes a package-qualified `ViewIdResourceName`.
  - `BottomNavigationViewUtils.CreateMoreBottomSheet` accepts a callback so overflow "More" rows can receive the corresponding `ShellContent.AutomationId`.

* **iOS and MacCatalyst**
  - `ShellItemRenderer` assigns the `TabBar.AutomationId` to `UITabBar.AccessibilityIdentifier`.
  - `ShellSectionRenderer` assigns each `UITabBarItem` identifier using `ShellSection.AutomationId`, then `ShellSection.CurrentItem.AutomationId`, then the title as a fallback.

* **Windows**
  - `ShellItemHandler.Windows` applies the existing automation-property mapping to the root `MauiNavigationView` and propagates each `BaseShellItem.AutomationId`.
  - `NavigationViewItemViewModel` carries `AutomationId` and `AccessibilityView`; `TabbedPageStyle.xaml` binds them to each native `NavigationViewItem`.
  - `AutomationProperties.IsInAccessibleTree == false` maps to `AccessibilityView.Raw`; true or unset maps to `AccessibilityView.Content`.

### Testing

Adds an all-platform `Issue39055` HostApp scenario with `main_tab_bar`, `tab_home`, `tab_browse`, and `tab_settings` IDs, plus a Shell-category Appium test that waits for all four identifiers.

### Issues Fixed

Fixes #39055

**Platforms affected:** Windows, Android, iOS, and MacCatalyst.

| Before Issue Fix | After Issue Fix |
|---|---|
| <img width="1095" height="708" alt="BeforeFix39055" src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028" /> | <img width="1115" height="728" alt="AfterFix39055" src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2" /> |

🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Phase Status

Phase Status Notes
Pre-Flight ✅ COMPLETE Trusted read-only evidence-first context consumed
Code Review NEEDS_CHANGES (low confidence) 1 error, 1 warning; required checks pending/undetermined
Gate ✅ PASSED Windows Issue39055 fails without the PR and passes with it
Try-Fix Alternative generation: not requested Intentional evidence-first omission
Refinement ✅ IMPLEMENTED AND VALIDATED One pr-plus-reviewer patch; focused Windows test passed 1/1
Report ✅ COMPLETE pr-plus-reviewer selected

Code Review and Candidate Comparison

Candidate Expert finding status Validation Rank
pr Leaves the blocking Android stale-delegate defect unresolved; Android overflow coverage warning also remains Gate passed on Windows 2
pr-plus-reviewer Clears stale delegates for empty tab-bar and tab-item IDs during remap; overflow coverage warning remains Candidate-local Windows Issue39055 passed 1/1 1

pr-plus-reviewer is the strongest real candidate because it addresses the expert review's source-backed correctness defect while preserving the required Windows regression result. It is an unsubmitted refinement, so the submitted PR still requires changes. No Android execution was performed, and the Windows pass does not prove the Android state transition or overflow path; this candidate is not represented as fully merge-ready.

Summary

The submitted cross-platform AutomationId propagation works for the Gate scenario, but Android native tab views can retain a previous ID when a remap supplies an empty ID. The consolidated refinement makes delegate assignment idempotent by clearing stale state and passes the single permitted candidate validation. The raw PR cannot be approved while that blocking finding remains in submitted HEAD.

Root Cause

UpdateTabBarAutomationIds() only called ViewCompat.SetAccessibilityDelegate for non-empty IDs. SetupMenu() can remap Shell items onto reused native bottom-navigation views, so a view that previously received an AutomationIdAccessibilityDelegate had no transition back to an empty delegate state.

Fix Quality

The refinement is localized to the existing Android mapping method and initializes both set and clear states without adding shared state or changing public API. git diff --check passed and the focused Windows UI test passed from the prescribed candidate sandbox. Confidence remains limited because required CI was pending/undetermined during expert review, the Android clearing behavior was not executed, and the new Android overflow branch lacks regression coverage.


🔗 Regression Cross-Reference

🔍 Regression Cross-Reference

⚠ Overlaps with prior bug-fix PRs — same files modified, but no exact line revert detected.

File Fix PR Fixed issue(s)
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs #36558 #36466

📱 UI Tests — Shell,ViewBaseTests

Detected UI test categories: Shell,ViewBaseTests

❌ Deep UI tests — 433 passed, 5 failed, 15 skipped across 2 categories on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
Shell 318/338 (5 ❌, 15 skipped) 1 diff PNG
ViewBaseTests 115/115 ✓ —
🔍 AI analysis of failures — PR-related vs unrelated

🔍 AI-generated triage (GitHub Copilot CLI) — a heuristic judgement of whether each deep UI test failure is connected to this PR's changes. Verify before relying on it.

Mixed / uncertain: see the grouped assessment below.

  • ✗ PR-related — Windows Shell tab-item discovery (~3 tests): all time out waiting for navViewItem, the exact NavigationViewItem template whose AutomationId and accessibility bindings this PR changes on Windows, plausibly replacing the identifier Appium previously resolved.
  • ● Unrelated — Shell flyout options lookup (~1 test): the timeout occurs on FlyoutIconCoffee, an in-page option control outside the modified NavigationView item automation paths, matching a generic element-wait flake.
  • ● Unrelated — Shell Search visual baseline (~1 test): the 0.78% screenshot delta is a baseline/rendering mismatch, while this PR changes only Windows Shell navigation automation metadata and no SearchHandler colors or visual styling.

Strongest signal: the three tab-title failures converge on the newly modified Windows AutomationId surface; the other two fail in untouched controls or visuals.

❌ Shell — 5 failed tests
VerifyFirstShellContentTitle
System.TimeoutException : Timed out waiting for element...
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2790
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2817
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 826
   at Microsoft.Maui.TestCases.Tests.Issues.Issue26049.TabNavigationViewItemIfWindows() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26049.cs:line 53
   at Microsoft.Maui.TestCases.Tests.Issues.Issue26049.VerifyFirstShellContentTitle() in /_/src/Controls/test
...
VerifyNewlyAddedShellContentTitle
System.TimeoutException : Timed out waiting for element...
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2790
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2817
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 826
   at Microsoft.Maui.TestCases.Tests.Issues.Issue26049.TabNavigationViewItemIfWindows() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26049.cs:line 53
   at Microsoft.Maui.TestCases.Tests.Issues.Issue26049.VerifyNewlyAddedShellContentTitle() in /_/src/Controls
...
VerifyExistingTabTitle
System.TimeoutException : Timed out waiting for element...
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2790
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2817
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 826
   at Microsoft.Maui.TestCases.Tests.Issues.Issue26049.TabNavigationViewItemIfWindows() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26049.cs:line 53
   at Microsoft.Maui.TestCases.Tests.Issues.Issue26049.VerifyExistingTabTitle() in /_/src/Controls/tests/Test
...
VerifyShellFlyout_FlyoutIcon
System.TimeoutException : Timed out waiting for element...
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2790
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2817
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 826
   at Microsoft.Maui.TestCases.Tests.ShellFeatureTests.VerifyShellFlyout_FlyoutIcon() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ShellFeatureMatrixTests.cs:line 755
   at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments
...
VerifyShellSearch_TextColor
VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: VerifyShellSearch_TextColor.png (0.78% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow
at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance, Boolean includeTitleBar) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 299
   at Microsoft.Maui.TestCases.Tests.ShellSearchHandlerFeatureTests.VerifyShellSearchScreenshot() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ShellSearchHandlerFeatureTests.cs:line 41
   at Microsoft.Maui.TestCases.Tests.ShellSearchHandlerFeatureTests.VerifyShellSearch_TextColor() in /_/src/Controls/tests/TestCases.Shared.
...

📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)


🧭 Next Steps — reviewer changes required

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

Why: The reviewer refinement wins because it fixes the submitted PR's source-backed stale Android accessibility-delegate state while retaining a passing candidate-local Windows Issue39055 regression result. The refinement is not in submitted HEAD, and Android overflow coverage remains missing, so the PR requires changes.

Address the actionable findings in this review before merging.

@github-actions github-actions Bot 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.

Expert Review — 9 findings

Reviewed commit 0301d5f.

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 Oct 16, 2026
@MauiBot

MauiBot commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@SubhikshaSf4851 — existing-test verification for commit 0301d5f5.

Result PASSED Platform Android Commit 0301d5f5


🧪 Gate analysis — click to expand

✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence.

🖥 UI tests
Test group Without fix With fix
Issue39055 ✅ Failed as expected (1524s) ✅ Passed (696s)
Execution log excerpts

Without fix Issue39055

     at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2790
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2817
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 826
   at Microsoft.Maui.TestCases.Tests.Issues.Issue39055.Issue39055TabBarAutomationIdShouldBeSet() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39055.cs:line 19
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

With fix Issue39055

2 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.13)
[xUnit.net 00:00:00.16]   Discovering: Controls.TestCases.Android.Tests
[xUnit.net 00:00:00.60]   Discovered:  Controls.TestCases.Android.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 10/16/2026 19:43:04 FixtureSetup for Issue39055(Android)
>>>>> 10/16/2026 19:43:06 Issue39055TabBarAutomationIdShouldBeSet Start
>>>>> 10/16/2026 19:43:09 Issue39055TabBarAutomationIdShouldBeSet Stop
  Passed Issue39055TabBarAutomationIdShouldBeSet [3 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue39055.trx
Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 19.1692 Seconds
>>> TRX_RESULT_FILE: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue39055.trx

PR head: 0301d5f5.

Without-fix baseline: 3a7d7287.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Oct 16, 2026
kubaflo added a commit that referenced this pull request Nov 13, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 13, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 13, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 17, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 17, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 17, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
<!-- 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!

This pull request enhances accessibility across Android, iOS, and
Windows by ensuring that `AutomationId` properties are properly set and
propagated for `TabBar` and its items in Shell-based navigation. This
allows for improved UI testing and accessibility tool support. The
changes also introduce new test cases to verify this behavior and update
templates and view models to support the new properties.

**Accessibility Improvements for TabBar and Tabs:**

- **Android:**
- Sets `AutomationId` as an accessibility identifier for the TabBar and
each tab item using a custom accessibility delegate, ensuring the IDs
are correctly exposed to accessibility services and UI tests.
[[1]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R252)
[[2]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R806-R847)
[[3]](diffhunk://#diff-c72dacae6958897dd7b4f67450655acf772923bbde34fe006669bf7c40da3a49R879-R897)
- Updates the bottom sheet dialog for overflow tabs to set
`AutomationId` for each tab row.
[[1]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L380-R381)
[[2]](diffhunk://#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5L412-R413)

- **iOS:**
- Assigns `AutomationId` to the TabBar and each tab's
`UITabBarItem.AccessibilityIdentifier`, including handling for overflow
menu items and current tab changes.
[[1]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R444)
[[2]](diffhunk://#diff-81b98744125a5a84b4105f87d22776bab682d60aed4c249828964f7e49ccbe00R658-R659)
[[3]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16R492-R493)
[[4]](diffhunk://#diff-67b224ca943705bdaad650e58532c04e9cb35343c80ff0fc5db019fd3e6aef16L711-R730)

- **Windows:**
- Maps `AutomationId` and accessibility view properties to the TabBar
and its items, updating the `NavigationViewItemViewModel` and XAML
templates to bind these properties.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR23)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR49-R54)
[[3]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR387-R393)
[[4]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR719-R724)
[[5]](diffhunk://#diff-859c951c4deff1e87ff9620fb2844f38efa37a113d4fb2663063b18da5d69698R8-R9)
[[6]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR101-R103)
[[7]](diffhunk://#diff-c3820f3eb829d9733ff825f6a6a74b39a5d6c186db9190269a4adea3a773447aR123-R134)
- Ensures these properties are updated in response to property changes
and when creating platform elements.
[[1]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbR69)
[[2]](diffhunk://#diff-65baaa6f7d4dca37654863b5afebfc496e3fa461d3ce0f1e3698d78fe60da8bbL406-R426)

**Testing and Verification:**

- **New Test Case:**
- Adds a new issue test (`Issue39055`) to verify that `AutomationId` is
correctly set for the TabBar and each tab, with platform-specific
coverage and UI test assertions.
[[1]](diffhunk://#diff-3e4463073c010f8f2aee00fc1327a8acfe10182c38c9cc5ebd1f01b6739c9b8bR1-R144)
[[2]](diffhunk://#diff-bd74f50b7cdff89e940b4ee2f1b09554a08fbfce725f6ba7688449f5c4293916R1-R28)

**Other Updates:**

- Updates an existing test to use the new `AutomationId` for tab
selection on Windows.

These changes collectively ensure that the TabBar and its items are
accessible and easily identifiable in UI automation scenarios across all
supported platforms.

### 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 #39055 

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1095" height="708" alt="BeforeFix39055"
src="https://github.com/user-attachments/assets/dd2f78b2-59fb-4567-a99f-f4134f94f028"
/> | <img width="1115" height="728" alt="AfterFix39055"
src="https://github.com/user-attachments/assets/69c2c68e-b9c0-4c65-bdf8-c743d54a91d2"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, correcting a regression introduced directly on that
candidate by #39406.

### Description of Change

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

Make the Windows `ShellItemHandler` automation mapper explicitly clear
the content navigation view's ID for non-TabBar Shell items. Previously,
`ConnectHandler` assigned every Shell item's ID to that content root,
but `MapAutomationId` did nothing for FlyoutItems. The root could
therefore share an ID with the actual flyout navigation item, and retain
the previous FlyoutItem's ID when the handler was reused.

In the candidate's Windows `Issue8308` failure, the native tree exposes
a visible, 1008-by-680 content root with `AutomationId="Page 1"` while
Page 2's `Instructions2` label is displayed. The existing flyout helper
can target that content root instead of the flyout item, leaving the app
on Page 2.

The mapper now assigns IDs only to TabBars with visible tabs and clears
the ID otherwise. The existing `SetAutomationProperties` call is
retained, preserving accessibility properties, including
`IsInAccessibleTree`; ShellContent/tab IDs are unchanged. No selectors,
test IDs, timeouts, retries, or pipeline configuration are changed.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check` - passed.
- Native Windows validation on head
`2f6557d5574aa5d20a290d7f31ba6e937f08cee4`: [build
1678537](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678537),
using the existing `maui-pr-uitests` Windows and Windows CV1 build/test
stages. Both native builds succeeded; the regression and preservation
tests below passed on their initial attempts. No pipeline files or
filters were changed.

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46790596/100042` | Passed, 4550 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46790610/100032` | Passed, 4436 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46791298/100002` | Passed, 2237 ms |

Raw Azure logs retrieved with `az` confirm these passes: CV1 log `967`,
CV2 log `983`, and Shell1 log `1213`. Shell1 finished with 154 passed
and 2 skipped. The CV2 grouping-gallery fixture needed the existing
retry after a setup timeout; the regression test itself was not retried.

- Before the correction, [candidate build
1678469](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678469)
failed `NavigatingBackToCollectionViewShouldNotCrash` initially and on
retry in both Windows handler configurations, at the final
`WaitForElement("Instructions")`. Exact CV2 result: run `46787104`,
result `100048`; CV1 raw log `1073` has the same failure.
- The unchanged test passed on the `net11` baseline: [build
1676275](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1676275),
run `46717494`, result `100044`.

The validation build is **not globally green**: two existing candidate
visual regressions remain, `Issue21202Test` (4.45%) and
`ButtonLayoutAndSpacingTests` / `Issue22433_Default` (2.23%). They
repeat on retry in raw log `1231`, exactly matching the unmodified
candidate in builds `1678469` (log `1243`) and `1678143` (log `993`).
They are being investigated separately; this PR does not change their
snapshots or tolerances or claim the candidate is ready to merge.

### 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. -->

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
…es (#40208)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, following the review finding on already-merged #40202. The
feature branch starts at candidate commit
`53f7830c8ac75da171c9c890f29fddc5870cd0e5`.

### Description of Change

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

Refresh `Element.AutomationId` through `Handler.UpdateValue` whenever
the Windows Shell TabBar visibility mapping runs. The automation mapper
depends on `IShellItemController.ShowTabs`: #40202 correctly cleared IDs
for hidden TabBars and non-TabBar content roots, but changing visibility
did not remap that dependent property. An initially hidden TabBar
therefore stayed unfindable by its configured ID after being shown.

The one-line production change keeps the non-TabBar collision correction
and all accessibility-property setup intact. Hidden TabBars have no
content-root automation ID; visible TabBars regain their configured ID,
including across repeated transitions. The refresh goes through the
property mapper so application mapper customizations are respected.

Extend the existing Windows `ShellTabBarVisibilityToggleWorks` device
test to start both hidden and visible, toggle repeatedly, and assert the
native pane mode, visible pane state, and automation ID at each step.
The existing Issue8308 and Issue39055 UI scenarios are unchanged.

**Validation**

- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs
--verbosity quiet` - passed.
- `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src
--exclude-diagnostics CA1822 --include
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
--verbosity quiet` - passed.
- `git diff --check 53f7830 HEAD` -
passed.
- Regression-only native device baseline:
[1678821](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678821),
exact head `2a9fc02a7d66d6c1fcefde547afafa9041c7516e` - **both new cases
failed as expected**, in packaged and unpackaged Windows execution.
Initially hidden: expected `tab_bar` after showing, but got an empty ID.
Initially visible: expected an empty ID after hiding, but retained
`tab_bar`. The Shell category had 84 passed and these 2 assertion
failures in each mode.
- Fixed native device validation:
[1678822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678822),
exact head `022ee17d85dad38298154813190b9faa3f3f9dcd` - **both cases
passed in both modes**, with the entire Shell category passing **86/86**
in each mode. Both Controls device-test work items passed.
- Unchanged Windows UI preservation:
[1678820](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678820),
the same fixed head, using existing Windows CV1/CV2 stages -
**succeeded**. All three focal tests passed on their initial attempts:

| Test | Configuration | Exact run/result | Result |
| --- | --- | --- | --- |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV2 |
`46799542/100019` | Passed, 4507 ms |
| `NavigatingBackToCollectionViewShouldNotCrash` | Windows CV1 |
`46799724/100009` | Passed, 4636 ms |
| `Issue39055TabBarAutomationIdShouldBeSet` | Windows |
`46800134/100001` | Passed, 2360 ms |

Raw Azure logs retrieved with `az` confirm the passes: CV2 log `967`,
CV1 log `1107`, and Shell1 log `1217`. Both CollectionView7 shards
passed 49/49; Shell1 passed 154 with 2 skipped.

The native device assertion evidence is in
`TestResults-com_microsoft_maui_controls_devicetests_Shell.xml`, under
both `Controls.DeviceTests-packaged` and
`Controls.DeviceTests-unpackaged`: [baseline Helix
job](https://helix.dot.net/api/jobs/92f8bd22-5482-419a-8329-0dbf320a4af8/details)
and [fixed Helix
job](https://helix.dot.net/api/jobs/4899e6e1-41db-4da3-836c-475a2bd0b7b2/details).
Raw Azure submission logs `82` and `87` tie those jobs to the pinned
source builds.

The fixed device pipeline is **not globally green**: its Windows leg
still fails `Core.DeviceTests-unpackaged` on
`SwitchHandlerTests.CustomOnColorRestoresConfiguredHoverResource(theme:
"HighContrastBlack")`, where `Assert.Single` found two resource
dictionaries. This is separate from the Controls Shell change and is
being investigated independently. The native Shell assertions and both
Controls work items pass; this PR does not claim release readiness.

No pipeline files, selectors, timeouts, snapshots, or tolerances are
changed.

### 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. -->

Addresses the hidden-to-visible [review finding on
#40202](#40202 (comment)).

Relates to #40116, #39406, and #8308.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration 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-review-in-progress AI review is currently running for this PR 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.

[UITest][Shell] TabBar/ShellContent AutomationId not exposed as resource-id (Android) or accessibilityIdentifier (iOS)

5 participants