Repository navigation
[Android] Fix SearchHandler toolbar icon tint when Shell.ForegroundColor is set on a TabBar, Tab, or ShellContent - #39346
Conversation
…olbar icons The collapsible SearchHandler icon and the back arrow of the search view read Shell.ForegroundColor from the page and from the Shell only. A value set on a TabBar, Tab, FlyoutItem, or ShellContent was ignored, and the icons were white. Get the color from Shell.GetAppearanceForPivot, which the other toolbar colors use. Update the menu item tint when Toolbar.IconColor changes. Fixes dotnet#16309 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39346Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39346" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@edgiardina! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @edgiardina! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@edgiardina — new AI review results are available based on commit
77f2e44.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: ANDROID · Base: main · Merge base: f16eb798
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 ShellTests (CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement) Category=Shell |
✅ FAIL — 517s | ✅ PASS — 501s |
🔴 Without fix — 📱 ShellTests (CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement): FAIL ✅ · 517s
(no coded error found; showing last 1200 chars)
moryBytes": 8322998272
},
"target": {
"kind": "emulator",
"name": "sdk_gphone_x86_64",
"identifier": "emulator-5554",
"operatingSystem": "Android",
"operatingSystemVersion": "11",
"apiLevel": 30,
"architecture": "x86_64",
"supportedArchitectures": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi"
],
"manufacturer": "Google",
"model": "sdk_gphone_x86_64",
"productName": "sdk_gphone_x86_64",
"buildFingerprint": "google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys",
"cpuModel": "0",
"cpuMaxFrequencyHertz": 2000,
"totalMemoryBytes": 2077544448
}
}
}
<<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.controls.devicetests'..
info: Successfully uninstalled com.microsoft.maui.controls.devicetests
XHarness exit code: 1 (TESTS_FAILED)
Passed: 0
Failed: 1
Skipped: 0
Total: 1
Tests completed with exit code: 1
🟢 With fix — 📱 ShellTests (CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement): PASS ✅ · 501s
(no coded error found; showing last 1200 chars)
"totalMemoryBytes": 8322998272
},
"target": {
"kind": "emulator",
"name": "sdk_gphone_x86_64",
"identifier": "emulator-5554",
"operatingSystem": "Android",
"operatingSystemVersion": "11",
"apiLevel": 30,
"architecture": "x86_64",
"supportedArchitectures": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi"
],
"manufacturer": "Google",
"model": "sdk_gphone_x86_64",
"productName": "sdk_gphone_x86_64",
"buildFingerprint": "google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys",
"cpuModel": "0",
"cpuMaxFrequencyHertz": 2000,
"totalMemoryBytes": 2077544448
}
}
}
<<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.controls.devicetests'..
info: Successfully uninstalled com.microsoft.maui.controls.devicetests
XHarness exit code: 0
Passed: 1
Failed: 0
Skipped: 0
Total: 1
Tests completed successfully
📁 Fix files reverted (2 files)
src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cssrc/Controls/src/Core/Shell/Shell.cs
📋 Pre-Flight — Context & Validation
Pre-Flight Context
Scope snapshot: PR #39346 is an open, single-commit Android fix at head 77f2e447de9595fff4df96a4c08f6542c72c3880. The immutable submitted diff changes three files (+57/-2). This is context gathering only, not an exhaustive review or implementation recommendation.
Reported problem
- #16309 reports that Android Shell’s collapsed
SearchHandlerspyglass and the expanded search view’s back arrow remain white, potentially becoming invisible on a light toolbar, whenShell.ForegroundColoris configured on an intermediate Shell element. - The original reproduction sets the color on a
TabBar. A later retest reports the behavior still present in .NET MAUI 10.0.110 on Android 14/API 34:TabBarorShellContent: expected configured color, observed white.- Page: configured color works.
- #36016 previously changed the SearchHandler tint lookup to prefer
ShellToolbarTracker.TintColor, then the page’s attachedShell.ForegroundColor, then the Shell’s value, with white applied by the Android conversion call sites as the final fallback. That covers values set directly on the page or Shell but not values set between them, such asShellContent,Tab,TabBar, orFlyoutItem.
Changed files and mechanism
| File | Submitted change |
|---|---|
src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs |
Resolves SearchHandler tint through _shell.GetAppearanceForPivot(page)?.ForegroundColor instead of reading only Shell.GetForegroundColor(page). Also re-tints the SearchHandler menu icon when the root Toolbar.IconColor changes. |
src/Controls/src/Core/Shell/Shell.cs |
Changes GetAppearanceForPivot(Element) from private to internal, exposing it only within the Controls assembly; no public API signature is added. |
src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs |
Adds an Android device test for a collapsible SearchHandler whose foreground is set on a TabBar, including a live red-to-lime update. |
The relevant source flow is:
Shell.GetAppearanceForPivot(page)walks to the active page and then upward through the Shell hierarchy.ShellAppearance.Ingestonly fills values not already resolved, so the nearest explicitly set foreground wins. The algorithm has special handling to include the activeShellContentwhen a pushed page is attached through aShellSection.GetSearchHandlerTintColornow returns explicit trackerTintColor, otherwise the resolved appearance foreground, otherwiseShell.GetForegroundColor(_shell). Android call sites still use white when converting a null result.- Initial creation of the collapsible menu icon and attachment of its expanded action-view back button both call this helper.
- Android’s
ShellToolbarAppearanceTrackerwrites the effective appearance foreground into the root Shell toolbar’sIconColor.ShellToolbarTrackeralready observes that toolbar and copies changes to the platform-specific toolbar; the new property-name check additionally invokesUpdateToolbarItemsTintColors. - That re-tint method locates the collapsible placeholder menu item and applies an Android drawable color filter. This addresses the event gap where changing an intermediate element does not directly raise
ForegroundColorchanges on either the current page or the Shell.
Platform-sensitive paths
- Functional rendering changes are in the Android compatibility Shell renderer, using AppCompat/Material toolbar menu items, drawables, and color filters.
- The new test is in the Android partial
ShellTestsclass and inspects rendered drawable pixels from aMaterialToolbar. Shell.csis shared cross-platform code, but the submitted functional caller is Android-only. Its accessibility change is assembly-internal and therefore does not itself create public API surface.- No iOS, Mac Catalyst, or Windows implementation files are changed. The PR description explicitly reports those platforms as untested.
Validation evidence and later requirements
-
Gate evidence supplied for this exact head: the new Android device test failed against baseline
f16eb798and passed against head77f2e447, on an Android 11/API 30 x86-64 emulator. The gate is already passed and must not be rerun. -
Author-reported evidence, not independently established here: 73 Android Shell device tests passed on an Android 14/API 34 emulator, plus manual checks for
TabBar,ShellContent, page-level color, and the expanded-search back arrow. -
Mandatory candidate regression test: after a candidate’s primary Android test succeeds, run exactly:
dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "ShellToolbarTests"A candidate that fails this regression test is required to be marked
Fail. -
The cross-reference comes from #36673, which also modified shared
Shell.csand addedShellToolbarTestscoverage. That prior fix preserves the distinction between user-supplied Shell title state and renderer-mirrored title state, preventing leakage into native window titles and associated macOS/Windows Shell layout behavior.
Remaining uncertainties
- The submitted automated test covers only
SearchBoxVisibility.Collapsible, aTabBarparent, and a runtime foreground change. It does not directly automate the expanded-search back-arrow path. ShellContent,Tab, andFlyoutIteminheritance scenarios are described or manually reported but are not individually exercised by the new test.UpdateToolbarItemsTintColorsdirectly re-tints only the collapsible placeholder menu item. Whether an already-expanded action-view back button updates correctly after a parent color changes remains unproven by the submitted test.- An unresolved inline PR comment calls out the missing expanded-search automation; this records a coverage gap rather than establishing a defect.
- The latest retrieved PR discussion says three Azure pipelines and a broader Android review pipeline were started, but their final outcomes were unavailable in the gathered context and are therefore unknown.
- No tests or commands were run for this context pass, and no conclusion is made about overall correctness or merge readiness.
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Verdict: NEEDS_DISCUSSION
Confidence: low
Inline findings: 0
Independent Assessment
The submitted Android fix changes SearchHandler tint lookup to use the resolved Shell appearance for the current page, and re-applies the collapsible menu icon tint when the effective toolbar icon color changes. The shared GetAppearanceForPivot accessibility change remains assembly-internal, and the submitted Android device test covers a TabBar foreground plus a live color update.
Findings
No concrete correctness defect was identified on an added or modified line. The expert reviewer wrote an empty JSON array to inline-findings.json.
Blast Radius and Failure Modes
- The runtime behavior change is localized to the Android Compatibility Shell toolbar path; there is no new startup path or static/shared state.
- Parent-level
Shell.ForegroundColornow follows the existing Shell appearance-resolution semantics. - The runtime recolor path is triggered through the observed
Toolbar.IconColorproperty change. - No subscription or disconnect/reconnect asymmetry is introduced by the submitted diff.
- External-output and trim/AOT contract checks are not applicable.
Evidence Gaps and Prior Review Reconciliation
- A prior inline review comment asks for automated coverage of the expanded SearchHandler back-arrow path. The submitted test exercises the collapsed icon and a live parent-color update, so the expanded path remains a coverage gap rather than a demonstrated defect.
- The trusted Gate passed for the exact submitted head: the new Android device test failed without the fix and passed with it.
- The expert pass could not retrieve the PR's required-check state because authenticated and anonymous GitHub status retrieval were unavailable. Required CI is therefore undetermined in this review evidence, which prevents an LGTM verdict and caps confidence at low.
Refinement Threshold
No pr-plus-reviewer refinement is warranted. The expert review identified neither a concrete actionable defect nor an unresolved behavioral mechanism backed by source or test evidence; adding a speculative patch solely to populate the comparison would violate evidence-first policy.
🛠️ 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.
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Trusted evidence-first context consumed for submitted head 77f2e447 |
| Code Review | NEEDS_DISCUSSION (low) | 0 errors, 0 warnings, 0 inline findings; required-check status is undetermined |
| Gate | ✅ PASSED | Android device test failed without the fix and passed with it |
| Regression | ✅ PASSED | ShellToolbarTests: 1 passed, 0 failed, 0 skipped |
| Try-Fix | Not requested | Evidence-first mode intentionally omitted alternative generation |
| Refinement | NOT GENERATED | No concrete defect or evidence-backed unresolved mechanism met the refinement threshold |
| Report | ✅ COMPLETE | Raw pr is the sole real candidate |
Code Review and Candidate Comparison
The raw pr candidate is the only implemented candidate. It fixes the tested parent-level foreground-color scenario, passes the trusted Gate, and passes the required regression test. The expert review found no actionable defect on a changed line, so evidence-first policy does not permit inventing a pr-plus-reviewer candidate.
The raw PR therefore wins the candidate comparison. Approval is nevertheless blocked by the expert review's NEEDS_DISCUSSION verdict: the submitted test does not directly exercise the expanded SearchHandler back-arrow path, and the required-check state could not be established from the available GitHub evidence. This report does not treat missing CI evidence as a pass or claim that the submitted candidate is merge-ready.
Summary
The submitted change is technically coherent and empirically fixes the tested Android regression. No better evidence-backed refinement was produced or warranted. Request changes pending resolution of the expert evidence gap, principally confirmation of required CI and disposition of the expanded-search coverage concern.
Root Cause
Android SearchHandler toolbar icons previously resolved Shell.ForegroundColor only from the page and root Shell. Values set on intermediate Shell elements such as ShellContent, Tab, TabBar, or FlyoutItem were skipped. Runtime changes on those elements also did not raise the page or Shell property changes used by the existing tint update path.
Fix Quality
The fix reuses Shell.GetAppearanceForPivot(page) so SearchHandler tint follows the same nearest-value appearance resolution as other Shell toolbar colors. It also re-tints the collapsible menu item when the effective Toolbar.IconColor changes. The accessibility change to GetAppearanceForPivot is assembly-internal, the Android device test proves the collapsed TabBar case and a live red-to-lime update, and the overlapping ShellToolbarTests regression suite passes. The expanded action-view back-arrow update remains unproven by submitted automation, and broader required CI evidence is unavailable.
🔗 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/Shell/Shell.cs |
#36673 | #36562 |
src/Controls/src/Core/Shell/Shell.cs |
#35896 | #35249 |
🧪 Regression Tests to Verify
These tests were added by the overlapping fix PRs. Running them to verify no side-effect regressions:
| Fix PR | Type | Test | Filter |
|---|---|---|---|
| #36673 | UnitTest | ShellToolbarTests | ShellToolbarTests |
🧪 Regression Test Results
✅ PASSED — 1 passed, 0 failed, 0 skipped
| Fix PR | Test | Type | Result |
|---|---|---|---|
| #36673 | ShellToolbarTests | UnitTest | ✅ PASSED |
📱 UI Tests — Shell
Detected UI test categories: Shell
[!WARNING]
No UI test results were produced for the detected categories. The PR build itself was
fine — the deep UI stage was skipped or interrupted on infrastructure (the
merge-for-testing step, emulator/simulator boot, or an Appium hang), not by this PR's code.
This is usually transient; the review re-runs on new commits (a maintainer can also re-run it).
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📊 maui-prNo failures found. 🧪 maui-pr-devicetestsNo failures found. 🧪 maui-pr-uitests
🧭 Follow-up — actions and refreshNext action: Restore complete UI evidence; compare unresolved tests individually on base/head with identical setup.
|
There was a problem hiding this comment.
Expert Review
@edgiardina — new AI review results are available based on commit
77f2e44.
🔬 Review details
Coverage: 1/5 dimensions; finding validation incomplete.
Dimensions:
- ✅ 5. Logic and Correctness Verification
⚠️ 6. Regression Prevention and Test Coverage (no result)⚠️ 12. Backward Compatibility and Migration (no result)⚠️ 16. Complexity Reduction (no result)⚠️ 25. Navigation & Shell (no result)
AI source/history review only; no builds or tests run. Required CI and human approval still apply.
|
|
||
| // IconColor follows the effective Shell.ForegroundColor, including values set on a parent | ||
| // ShellItem/ShellSection/ShellContent that do not raise a property change on the page or the Shell. | ||
| if (e.PropertyName == nameof(Toolbar.IconColor)) |
There was a problem hiding this comment.
[moderate] Navigation & Shell - Refresh the search tint when a retained tab becomes current, not only when the shared IconColor changes. Visit bottom Tab A with a red parent foreground and a collapsible SearchHandler, switch to lime Tab B, change A's parent foreground to lime while B is selected, then return directly to A. A's retained tracker skips the refresh while B is current, and returning leaves the root IconColor unchanged at lime, so Toolbar.SetProperty suppresses this notification. The Page setter also skips the unchanged page, while OnShellNavigated and OnHiddenChanged refresh only the navigation/title state. A's search icon consequently remains red instead of lime. The added test changes color only on the selected tab and does not exercise this path.
PR Test Gate
🧪 Gate analysis — click to expand✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence. 📱 Device tests
Execution log excerptsWithout fix With fix PR head: 77f2e447. Without-fix baseline: 18542507. |
…lor is set on a TabBar, Tab, or ShellContent (#39346) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change On Android, the toolbar icon of a collapsible `SearchHandler` and the back arrow of the expanded search view ignore `Shell.ForegroundColor` when the property is set on a `TabBar`, `Tab`, `FlyoutItem`, or `ShellContent`. The icons are white. #36016 made `ShellToolbarTracker.GetSearchHandlerTintColor` read `Shell.ForegroundColor` from the page and from the `Shell`. It does not read the elements between the two. The other toolbar colors come from `Shell.GetAppearanceForPivot`, which reads all of them. This change does the following: - `GetSearchHandlerTintColor` gets the color from `Shell.GetAppearanceForPivot(page)`. The order is now: `ShellToolbarTracker.TintColor`, the resolved appearance of the page, `Shell.ForegroundColor` of the Shell, white. - `Shell.GetAppearanceForPivot` changes from `private` to `internal`. There is no public API change. - `OnToolbarPropertyChanged` updates the menu item tint when `Toolbar.IconColor` changes. A color change on a parent element does not cause a property change on the page or on the Shell, thus the icon did not update at runtime. - A new device test, `CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement`, sets the color on a `TabBar`, examines the icon color, changes the color, and examines the icon again. ### Test results Android 14 (API 34) emulator, `Controls.DeviceTests`, `Category=Shell`: | Build | Result | |---|---| | With this change | 73 passed, 0 failed | | Test only, without the change in `ShellToolbarTracker` | 72 passed, 1 failed (the new test) | Manual test with the reproduction from the issue. Icon color in the toolbar: | `Shell.ForegroundColor` set on | 10.0.110 | This change | |---|---|---| | `TabBar` (red) | White | Red | | `ShellContent` (green) | White | Green | | Page (blue) | Blue | Blue | | `TabBar` (red), back arrow of the expanded search view | White | Red | I did not run the tests on iOS, MacCatalyst, or Windows. The change in `ShellToolbarTracker` is Android-only. ### Issues Fixed Fixes #16309
…lor is set on a TabBar, Tab, or ShellContent (#39346) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change On Android, the toolbar icon of a collapsible `SearchHandler` and the back arrow of the expanded search view ignore `Shell.ForegroundColor` when the property is set on a `TabBar`, `Tab`, `FlyoutItem`, or `ShellContent`. The icons are white. #36016 made `ShellToolbarTracker.GetSearchHandlerTintColor` read `Shell.ForegroundColor` from the page and from the `Shell`. It does not read the elements between the two. The other toolbar colors come from `Shell.GetAppearanceForPivot`, which reads all of them. This change does the following: - `GetSearchHandlerTintColor` gets the color from `Shell.GetAppearanceForPivot(page)`. The order is now: `ShellToolbarTracker.TintColor`, the resolved appearance of the page, `Shell.ForegroundColor` of the Shell, white. - `Shell.GetAppearanceForPivot` changes from `private` to `internal`. There is no public API change. - `OnToolbarPropertyChanged` updates the menu item tint when `Toolbar.IconColor` changes. A color change on a parent element does not cause a property change on the page or on the Shell, thus the icon did not update at runtime. - A new device test, `CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement`, sets the color on a `TabBar`, examines the icon color, changes the color, and examines the icon again. ### Test results Android 14 (API 34) emulator, `Controls.DeviceTests`, `Category=Shell`: | Build | Result | |---|---| | With this change | 73 passed, 0 failed | | Test only, without the change in `ShellToolbarTracker` | 72 passed, 1 failed (the new test) | Manual test with the reproduction from the issue. Icon color in the toolbar: | `Shell.ForegroundColor` set on | 10.0.110 | This change | |---|---|---| | `TabBar` (red) | White | Red | | `ShellContent` (green) | White | Green | | Page (blue) | Blue | Blue | | `TabBar` (red), back arrow of the expanded search view | White | Red | I did not run the tests on iOS, MacCatalyst, or Windows. The change in `ShellToolbarTracker` is Android-only. ### Issues Fixed Fixes #16309
…lor is set on a TabBar, Tab, or ShellContent (#39346) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change On Android, the toolbar icon of a collapsible `SearchHandler` and the back arrow of the expanded search view ignore `Shell.ForegroundColor` when the property is set on a `TabBar`, `Tab`, `FlyoutItem`, or `ShellContent`. The icons are white. #36016 made `ShellToolbarTracker.GetSearchHandlerTintColor` read `Shell.ForegroundColor` from the page and from the `Shell`. It does not read the elements between the two. The other toolbar colors come from `Shell.GetAppearanceForPivot`, which reads all of them. This change does the following: - `GetSearchHandlerTintColor` gets the color from `Shell.GetAppearanceForPivot(page)`. The order is now: `ShellToolbarTracker.TintColor`, the resolved appearance of the page, `Shell.ForegroundColor` of the Shell, white. - `Shell.GetAppearanceForPivot` changes from `private` to `internal`. There is no public API change. - `OnToolbarPropertyChanged` updates the menu item tint when `Toolbar.IconColor` changes. A color change on a parent element does not cause a property change on the page or on the Shell, thus the icon did not update at runtime. - A new device test, `CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement`, sets the color on a `TabBar`, examines the icon color, changes the color, and examines the icon again. ### Test results Android 14 (API 34) emulator, `Controls.DeviceTests`, `Category=Shell`: | Build | Result | |---|---| | With this change | 73 passed, 0 failed | | Test only, without the change in `ShellToolbarTracker` | 72 passed, 1 failed (the new test) | Manual test with the reproduction from the issue. Icon color in the toolbar: | `Shell.ForegroundColor` set on | 10.0.110 | This change | |---|---|---| | `TabBar` (red) | White | Red | | `ShellContent` (green) | White | Green | | Page (blue) | Blue | Blue | | `TabBar` (red), back arrow of the expanded search view | White | Red | I did not run the tests on iOS, MacCatalyst, or Windows. The change in `ShellToolbarTracker` is Android-only. ### Issues Fixed Fixes #16309
…lor is set on a TabBar, Tab, or ShellContent (#39346) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change On Android, the toolbar icon of a collapsible `SearchHandler` and the back arrow of the expanded search view ignore `Shell.ForegroundColor` when the property is set on a `TabBar`, `Tab`, `FlyoutItem`, or `ShellContent`. The icons are white. #36016 made `ShellToolbarTracker.GetSearchHandlerTintColor` read `Shell.ForegroundColor` from the page and from the `Shell`. It does not read the elements between the two. The other toolbar colors come from `Shell.GetAppearanceForPivot`, which reads all of them. This change does the following: - `GetSearchHandlerTintColor` gets the color from `Shell.GetAppearanceForPivot(page)`. The order is now: `ShellToolbarTracker.TintColor`, the resolved appearance of the page, `Shell.ForegroundColor` of the Shell, white. - `Shell.GetAppearanceForPivot` changes from `private` to `internal`. There is no public API change. - `OnToolbarPropertyChanged` updates the menu item tint when `Toolbar.IconColor` changes. A color change on a parent element does not cause a property change on the page or on the Shell, thus the icon did not update at runtime. - A new device test, `CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement`, sets the color on a `TabBar`, examines the icon color, changes the color, and examines the icon again. ### Test results Android 14 (API 34) emulator, `Controls.DeviceTests`, `Category=Shell`: | Build | Result | |---|---| | With this change | 73 passed, 0 failed | | Test only, without the change in `ShellToolbarTracker` | 72 passed, 1 failed (the new test) | Manual test with the reproduction from the issue. Icon color in the toolbar: | `Shell.ForegroundColor` set on | 10.0.110 | This change | |---|---|---| | `TabBar` (red) | White | Red | | `ShellContent` (green) | White | Green | | Page (blue) | Blue | Blue | | `TabBar` (red), back arrow of the expanded search view | White | Red | I did not run the tests on iOS, MacCatalyst, or Windows. The change in `ShellToolbarTracker` is Android-only. ### Issues Fixed Fixes #16309
…lor is set on a TabBar, Tab, or ShellContent (#39346) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change On Android, the toolbar icon of a collapsible `SearchHandler` and the back arrow of the expanded search view ignore `Shell.ForegroundColor` when the property is set on a `TabBar`, `Tab`, `FlyoutItem`, or `ShellContent`. The icons are white. #36016 made `ShellToolbarTracker.GetSearchHandlerTintColor` read `Shell.ForegroundColor` from the page and from the `Shell`. It does not read the elements between the two. The other toolbar colors come from `Shell.GetAppearanceForPivot`, which reads all of them. This change does the following: - `GetSearchHandlerTintColor` gets the color from `Shell.GetAppearanceForPivot(page)`. The order is now: `ShellToolbarTracker.TintColor`, the resolved appearance of the page, `Shell.ForegroundColor` of the Shell, white. - `Shell.GetAppearanceForPivot` changes from `private` to `internal`. There is no public API change. - `OnToolbarPropertyChanged` updates the menu item tint when `Toolbar.IconColor` changes. A color change on a parent element does not cause a property change on the page or on the Shell, thus the icon did not update at runtime. - A new device test, `CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement`, sets the color on a `TabBar`, examines the icon color, changes the color, and examines the icon again. ### Test results Android 14 (API 34) emulator, `Controls.DeviceTests`, `Category=Shell`: | Build | Result | |---|---| | With this change | 73 passed, 0 failed | | Test only, without the change in `ShellToolbarTracker` | 72 passed, 1 failed (the new test) | Manual test with the reproduction from the issue. Icon color in the toolbar: | `Shell.ForegroundColor` set on | 10.0.110 | This change | |---|---|---| | `TabBar` (red) | White | Red | | `ShellContent` (green) | White | Green | | Page (blue) | Blue | Blue | | `TabBar` (red), back arrow of the expanded search view | White | Red | I did not run the tests on iOS, MacCatalyst, or Windows. The change in `ShellToolbarTracker` is Android-only. ### Issues Fixed Fixes #16309
Description of Change
On Android, the toolbar icon of a collapsible
SearchHandlerand the back arrow of the expanded search view ignoreShell.ForegroundColorwhen the property is set on aTabBar,Tab,FlyoutItem, orShellContent. The icons are white.#36016 made
ShellToolbarTracker.GetSearchHandlerTintColorreadShell.ForegroundColorfrom the page and from theShell. It does not read the elements between the two. The other toolbar colors come fromShell.GetAppearanceForPivot, which reads all of them.This change does the following:
GetSearchHandlerTintColorgets the color fromShell.GetAppearanceForPivot(page). The order is now:ShellToolbarTracker.TintColor, the resolved appearance of the page,Shell.ForegroundColorof the Shell, white.Shell.GetAppearanceForPivotchanges fromprivatetointernal. There is no public API change.OnToolbarPropertyChangedupdates the menu item tint whenToolbar.IconColorchanges. A color change on a parent element does not cause a property change on the page or on the Shell, thus the icon did not update at runtime.CollapsibleSearchHandlerIconUsesForegroundColorSetOnParentShellElement, sets the color on aTabBar, examines the icon color, changes the color, and examines the icon again.Test results
Android 14 (API 34) emulator,
Controls.DeviceTests,Category=Shell:ShellToolbarTrackerManual test with the reproduction from the issue. Icon color in the toolbar:
Shell.ForegroundColorset onTabBar(red)ShellContent(green)TabBar(red), back arrow of the expanded search viewI did not run the tests on iOS, MacCatalyst, or Windows. The change in
ShellToolbarTrackeris Android-only.Issues Fixed
Fixes #16309
🤖 Generated with Claude Code