Repository navigation
[Android][Material 3] Fix Shell navigation bar background color not applied - #39660
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39660Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39660" |
This comment has been minimized.
This comment has been minimized.
|
Hey there @@HarishwaranVijayakumar! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
🔵 Needs a closer look
No concrete defects were identified, but native Android rendering and relevant CI/UI-test results remain unverified.
No open issues 🎉
What changed in this PR
Restores Android Shell toolbar background colors when Material 3 is enabled without MAUI system-bar backgrounds, addressing the regression reported in #39599 after #38396.
Changes:
- Enables direct toolbar coloring when MAUI system-bar backgrounds are disabled, preserving the existing AppBar path when both features are enabled.
- Adds a Shell reproduction page and an Android Material 3 screenshot test.
| File | Description |
|---|---|
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39599.cs | Adds an Android screenshot test for Shell background coloring. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue39599.cs | Adds a Shell page with a blue toolbar background and white title. |
| src/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cs | Restores direct toolbar coloring when system-bar backgrounds are disabled. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| public void ShellBackgroundColorIsApplied() | ||
| { | ||
| App.WaitForElement("BackgroundColorLabel"); | ||
| VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)); |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - Add a discriminating regression assertion for Material 3 with MAUI system-bar backgrounds enabled, where direct toolbar tinting must remain skipped. This screenshot covers the disabled-system-bars case only. The existing Shell and NavigationPage *PreservesMaterial3AppBarLiftOnScrollStyling tests inspect the parent AppBar, including its lifted color, but do not check whether the child toolbar is tinted over it. Consequently, removing the guard entirely would still satisfy these assertions while hiding the AppBar highlight, the failure fixed by #38396/#37844. In the both-enabled configuration, assert that the toolbar remains untinted or check the visible toolbar color after lifting.
PR Test Gate
🧪 Gate analysis — click to expand❌ Failed. The selected tests did not meet the expected outcomes. Inspect the evidence before changing the test or fix. 🖥 UI tests
Execution log excerptsWithout fix With fix PR head: 4198848f. Without-fix baseline: 0e0f868d. |
|
/backport to release/11.0.1xx |
|
Started backporting to |
…39665) (#39670) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Manual backport of #39665 (commit e440e02) to the explicitly requested .NET 11 GA branch, `release/11.0.1xx`, after the automated backport conflicted. Create Android file-backed MediaPicker recovery fixtures in external cache rather than private app storage, track the created files, and delete them during fixture disposal. Existing private-storage rejection tests remain unchanged. The resulting MediaPicker test file is byte-for-byte identical to the source commit. **Conflict adaptation:** GA does not contain `GroupedCollectionViewEmptyViewTracksGroups`, `GroupedCollectionViewEmptyViewTracksGroups2`, or their shared helper. The source's `DynamicallyAccessedMembers(PublicConstructors)` annotation therefore has no applicable target. Keep `CollectionViewTests.iOS.cs` unchanged rather than importing unrelated CollectionView tests or product changes. **Validation:** - `git diff --cached --check` — passed before commit. - `git diff --exit-code e440e02 -- src/Essentials/test/DeviceTests/Tests/Android/MediaPickerRecovery_Tests.cs` — passed; exact source file preserved. - `git diff --exit-code HEAD -- src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs` — passed before commit; GA file unchanged. - `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Essentials/test/DeviceTests/Tests/Android/MediaPickerRecovery_Tests.cs --verbosity quiet` — passed. - `pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Essentials -Platform android -BuildOnly` — blocked by missing prerequisite MSBuild task outputs. - `dotnet build Microsoft.Maui.BuildTasks.slnf --verbosity quiet` — failed with NETSDK1140: GA references iOS/MacCatalyst 27.0, but the installed preview workloads support 26.5. No device tests ran; runtime validation remains for CI. ### 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. --> Backports #39665 for the Android MediaPicker recovery tests. No separate issue is closed by this backport. #39660 is handled independently by #39668 and is not included here. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: praveenkumarkarunanithi <100338903+praveenkumarkarunanithi@users.noreply.github.com>
…kground color not applied (#39668) Backport of #39660 to release/11.0.1xx /cc @kubaflo @HarishwaranVijayakumar Co-authored-by: HarishwaranVijayakumar <harishwaran.vijayakumar@syncfusion.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
Root Cause
Description of Change
Bug fix:
ToolbarExtensions.csso that the bar background is set when either Material3 is not enabled or whenUseMauiAndroidSystemBarBackgroundsis not enabled. This ensures the navigation bar background color is applied correctly on Android.Testing improvements:
Issue39599inTestCases.HostAppto manually verify that the navigation bar background color is blue and the title color is white.Issue39599inTestCases.Shared.Teststo verify that the Shell background color is applied as expected on Android.Issues Fixed
Fixes #39599
Tested the behavior in the following platforms
Output