[iOS] Fixed Flyout icon not updating when root page changes using InsertPageBefore#29924
Conversation
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| { | ||
| App.WaitForElement("InsertPageButton"); | ||
| App.Tap("InsertPageButton"); | ||
| VerifyScreenshot(); |
There was a problem hiding this comment.
@jsuarezruiz I have updated the pending snapshots for Mac and Windows.
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
0c26e1f to
c5bbac2
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes an iOS-specific issue where the flyout icon was not updated when the root page of a NavigationPage was changed using the InsertPageBefore method. The fix updates the logic to reference the actual native ViewControllers stack instead of the managed Pages collection, which was not kept in sync during InsertPageBefore operations.
Key Changes
- Updated flyout icon update logic to use ViewControllers stack for determining the first page
- Added automatic flyout icon update when inserting a page at index 0 (making it the new root)
- Added comprehensive UI test coverage with snapshots for all platforms
Reviewed changes
Copilot reviewed 3 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs |
Core fix: Updates InsertPageBefore to trigger flyout icon update when inserting at root position, and changes UpdateLeftBarButtonItem to use ViewControllers instead of Pages collection |
src/Controls/tests/TestCases.HostApp/Issues/Issue29921.cs |
Test implementation: Creates FlyoutPage with NavigationPage that demonstrates the InsertPageBefore root change scenario |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29921.cs |
NUnit test: Automates the test by clicking button and verifying screenshot shows correct state after root page change |
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FlyoutIconUpdatedAfterInsertPageBefore.png |
Expected visual output for iOS platform |
src/Controls/tests/TestCases.Android.Tests/snapshots/android/FlyoutIconUpdatedAfterInsertPageBefore.png |
Expected visual output for Android platform |
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FlyoutIconUpdatedAfterInsertPageBefore.png |
Expected visual output for Windows platform |
src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/FlyoutIconUpdatedAfterInsertPageBefore.png |
Expected visual output for MacCatalyst platform |
The changes are well-structured, follow established patterns in the codebase, and include appropriate test coverage. The fix correctly addresses the root cause by using the native ViewControllers collection which is properly maintained during InsertPageBefore operations.
🤖 AI Summary📊 Expand Full Review🔍 Pre-Flight — Context & Validation📝 Review Session — Update FlyoutIconUpdatedAfterInsertPageBefore.png ·
|
| Reviewer | Feedback | Status |
|---|---|---|
| jsuarezruiz | Missing snapshots for Mac and Windows | ✅ Resolved |
| kubaflo | iOS snapshot needed update | ✅ Resolved (commit 25655ad) |
| jsuarezruiz | Initially CHANGES_REQUESTED (snapshots); subsequently approved | ✅ Resolved |
| copilot-pull-request-reviewer | General review, no blocking comments | ✅ |
Prior Agent Review
A complete agent review was posted by user 'rmarinho':
- ✅ Pre-Flight: Complete
- ❌ Gate: Failed (environment blocker — snapshot dimension mismatch: 1124×2286 vs 1206×2472)
- ⏭️ Fix: Skipped (environment blocker)
- ✅ Report: APPROVE recommended
Gate failure was due to iPhone 14 simulator vs iPhone Xs baseline mismatch — not a code bug.
Files Classification
Fix files:
src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs(+9/-3)
Test files:
src/Controls/tests/TestCases.HostApp/Issues/Issue29921.cs(new, +63)src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29921.cs(new, +22)- 4 snapshot images (iOS, Android, Windows, Mac)
Test Type: UI Tests (Appium/VerifyScreenshot)
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #29924 | Update InsertPageBefore to call UpdateLeftBarButtonItem when index==0; change UpdateLeftBarButtonItem to use ViewControllers stack |
⏳ PENDING (Gate) | NavigationRenderer.cs (+9/-3) |
Original PR — uses native ViewControllers for accurate first-page detection |
🚦 Gate — Test Verification
📝 Review Session — Update FlyoutIconUpdatedAfterInsertPageBefore.png · 25655ad
Result: ✅ PASSED
Platform: ios
Mode: Full Verification (RequireFullVerification: true)
| Check | Expected | Actual | Status |
|---|---|---|---|
| Tests WITHOUT fix | FAIL | FAIL | ✅ |
| Tests WITH fix | PASS | PASS | ✅ |
- Tests FAIL without fix ✅ (bug is present, test detects it)
- Tests PASS with fix ✅ (fix resolves the issue)
Conclusion: Tests correctly validate the fix and catch the bug.
🔧 Fix — Analysis & Comparison
📝 Review Session — Update FlyoutIconUpdatedAfterInsertPageBefore.png · 25655ad
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | In InsertPageBefore when index==0, call UpdateLeftBarButtonItem via BeginInvokeOnMainThread (deferred, no change to UpdateLeftBarButtonItem logic) |
✅ PASS | 1 file | Different from PR: deferred instead of synchronous, keeps NavPageController.Pages in UpdateLeftBarButtonItem |
| 2 | try-fix | Override ViewControllers property setter to detect root changes, call UpdateLeftBarButtonItem via BeginInvokeOnMainThread. No InsertPageBefore change |
✅ PASS | 3 files (+PublicAPI) | Intercepts any root change from any code path, not just InsertPageBefore |
| 3 | try-fix | In InsertPageBefore, clear NavigationItem.LeftBarButtonItem directly on old root VC when index==0 and FlyoutPage present |
✅ PASS | 1 file | Minimal: directly clears stale button state without going through UpdateLeftBarButtonItem |
| 4 | try-fix | Use NavPage.Navigation.NavigationStack.FirstOrDefault() in UpdateLeftBarButtonItem + call from ViewWillAppear |
❌ FAIL | 1 file | 1.89% visual diff — NavigationStack doesn't sync correctly |
| 5 | try-fix | Modify SetFlyoutLeftBarButton as gatekeeper: check native position; update all VCs in InsertPageBefore |
✅ PASS | 1 file | Defense-in-depth: prevents flyout icon from being set on non-root VCs |
| 6 | try-fix | Hook UINavigationControllerDelegate.DidShowViewController to loop UpdateLeftBarButtonItem | ❌ FAIL | 1 file | 1.89% diff — UpdateLeftBarButtonItem still reads stale Pages without companion fix |
| 7 | try-fix | KVO observer on viewControllers key path | ❌ FAIL | 3 files | UIKit's setViewControllers:animated: bypasses KVO — fundamentally incompatible |
| PR | PR #29924 | Change UpdateLeftBarButtonItem to use ViewControllers instead of Pages; call it synchronously from InsertPageBefore when index==0 |
✅ PASS (Gate) | NavigationRenderer.cs (+9/-3) |
Original PR — minimal, cohesive two-part fix addressing both the trigger and the data source bug |
Cross-Pollination: 3 rounds completed. All 5 models confirmed NO NEW IDEAS in round 3.
Exhausted: Yes
Fix Selection Analysis
Passing candidates:
- Attempt 1 (BeginInvokeOnMainThread): Similar scope to PR but defers the call and doesn't fix the data source bug in UpdateLeftBarButtonItem. The deferred call works due to timing, but leaves
PagesvsViewControllersinconsistency unaddressed. - Attempt 2 (Override ViewControllers setter): Broader fix — catches root changes from any source. However, it touches more code (setter override + PublicAPI entries), and the deferred call adds complexity.
- Attempt 3 (Clear LeftBarButtonItem directly): Minimal. Works but bypasses the proper UpdateLeftBarButtonItem flow; less aligned with codebase patterns.
- Attempt 5 (SetFlyoutLeftBarButton gatekeeper): Defensive approach but modifies more code paths (every call to SetFlyoutLeftBarButton), increasing risk.
- PR's fix: Two-part, cohesive fix — (1) correct the data source bug (Pages → ViewControllers in UpdateLeftBarButtonItem), (2) add the explicit trigger when needed (InsertPageBefore index==0). Minimal, focused, and addresses both the symptom and root cause.
Selected Fix: PR's fix — it is the simplest, most cohesive solution that addresses both the root cause (stale Pages collection in UpdateLeftBarButtonItem) and the missing trigger. All try-fix alternatives either leave a secondary bug unaddressed or require more code changes. The PR's fix is optimal.
📋 Report — Final Recommendation
📝 Review Session — Update FlyoutIconUpdatedAfterInsertPageBefore.png · 25655ad
✅ Final Recommendation: APPROVE
Summary
PR #29924 fixes a bug where calling InsertPageBefore to change the root page in a NavigationPage (inside a FlyoutPage) on iOS would leave the flyout (hamburger) icon visible instead of showing a back button. The fix is minimal, correct, and well-tested.
Root Cause
UpdateLeftBarButtonItem was reading NavPageController.Pages.FirstOrDefault() to determine if the current page was the root. However, InsertPageBefore inserts pages directly into the native ViewControllers array without updating NavPageController.Pages, causing a stale read. Additionally, InsertPageBefore never called UpdateLeftBarButtonItem at all, so the bar button never had a chance to refresh.
Fix Quality
Two-part cohesive fix (+9/-3 lines):
- Data source fix (
UpdateLeftBarButtonItem): Change fromNavPageController.Pages.FirstOrDefault()to(n.ViewControllers.FirstOrDefault() as ParentingViewController)?.Child— always reads the accurate native stack - Trigger fix (
InsertPageBefore): Whenindex == 0(new root), callUpdateLeftBarButtonItem()on the displaced root VC to refresh its bar button item
Alternative Exploration Results
7 independent fix attempts were explored across 5 AI models:
- 4 PASS (attempts 1, 2, 3, 5): All alternatives found working solutions
- 3 FAIL (attempts 4, 6, 7): NavigationStack, DidShowViewController, and KVO approaches failed due to sync/timing issues
- All PASS candidates were more complex or less cohesive than the PR's fix
- The PR's fix was independently validated as the simplest and most complete solution
Code Quality Assessment
- ✅ Minimal change (9 additions, 3 deletions in one implementation file)
- ✅ Proper null-safety (
?.UpdateLeftBarButtonItem(),?.Child) - ✅ Correct guard condition (
index == 0precisely identifies new-root case) - ✅ Comprehensive UI tests with snapshots for all 4 platforms
- 🟡 Minor: Test label text slightly misleading ("Flyout icon is visible")
- 🟡 Minor: Missing trailing newline in one test file
- 🟡 Title should use "Fix" not "Fixed"
Platforms Tested (by author)
- iOS (primary affected platform)
- Android
- Windows
- Mac
Agent Test Results
- Gate: ✅ PASSED on iOS — tests FAIL without fix, PASS with fix
- Try-fix: Exhausted — PR's fix is the best available candidate
Recommendation: APPROVE — PR's fix is correct, minimal, and optimal.
📋 Expand PR Finalization Review
Title: ✅ Good
Current: [iOS] Fixed Flyout icon not updating when root page changes using InsertPageBefore
Description: ✅ Good
Description needs updates. See details below.
✨ Suggested PR Description
[!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 Detail
When using InsertPageBefore to insert a page before the current root in a NavigationPage inside a FlyoutPage, the flyout icon was not updated correctly: the old root page continued to show the flyout icon even though it was no longer the root.
Root Cause
The flyout icon visibility is determined in UpdateLeftBarButtonItem by comparing the current page against the first page in the navigation stack. Previously, this used NavPageController.Pages.FirstOrDefault(), which reflects the MAUI page collection. However, when InsertPageBefore inserts pages, it does so directly into the native ViewControllers array without updating NavPageController.Pages. This caused the root page detection to use stale data.
Description of Change
**1. trigger flyout icon update on root change:** InsertPageBefore
When the inserted page becomes the new root (index == 0), UpdateLeftBarButtonItem() is now called on the old root's ParentingViewController to clear its flyout icon.
**2. use native ViewControllers as source of truth:** UpdateLeftBarButtonItem
Changed firstPage detection from NavPageController.Pages.FirstOrDefault() to (n.ViewControllers.FirstOrDefault() as ParentingViewController)?.Child. Since InsertPageBefore inserts directly into ViewControllers, the native stack is always accurate. This also makes UpdateLeftBarButtonItem more robust for all callers.
Issues Fixed
Fixes #29921
Tested the behavior in the following platforms
- Android
- Windows
- iOS
- Mac
Screenshots
| Before Issue Fix | After Issue Fix |
|---|---|
iOSBeforeFixInsertpage.mov |
iOSAfterFixInsertPage.mov |
Code Review: ✅ Passed
Code Review: PR #29924
Changes Reviewed
NavigationRenderer. Two changes:cs
InsertPageBefore: Capture index, then callUpdateLeftBarButtonItem()on the old root when a new root is inserted (index == 0)UpdateLeftBarButtonItem: ChangedfirstPagesource fromNavPageController.Pages.FirstOrDefault()to(n.ViewControllers.FirstOrDefault() as ParentingViewController)?.Child
1. UpdateLeftBarButtonItem is called on old root, but new root may also need it
File: NavigationRenderer.cs:668
Code:
if (index == 0)
{
(target as ParentingViewController)?.UpdateLeftBarButtonItem();
}target is the old root (now at index 1 after insertion). Calling UpdateLeftBarButtonItem() on it correctly clears the flyout icon from the old root. However, the new root (pageContainer) also needs the flyout icon set. The screenshots confirm it works, so there must be another code path that sets it (possibly during the view controller's ViewDidAppear/ViewWillAppear lifecycle). This is acceptable, but worth a comment explaining that pageContainer gets its flyout icon via the normal view lifecycle.
Optional improvement:
if (index == 0)
{
// Clear flyout icon from old root (it's no longer the root).
// New root (pageContainer) gets its flyout icon via ViewWillAppear lifecycle.
(target as ParentingViewController)?.UpdateLeftBarButtonItem();
}2. firstPage change in UpdateLeftBarButtonItem is broader than InsertPageBefore
File: NavigationRenderer.cs:1659
Change:
// Before:
var firstPage = n.NavPageController.Pages.FirstOrDefault();
// After:
var firstPage = (n.ViewControllers.FirstOrDefault() as ParentingViewController)?.Child;This change affects all callers of UpdateLeftBarButtonItem, not just the InsertPageBefore path. The fix is logically correct (native ViewControllers is the source of truth), but it's a broader behavioral change than the PR description implies. The PR description says this is intentional (the Pages collection wasn't kept in sync), which is accurate. Worth noting in case this changes behavior in other navigation scenarios.
3. Non-nested helper classes in HostApp test file
File: TestCases.HostApp/Issues/Issue29921.cs
Issue29921Page1 and Issue29921Page2 are declared as public top-level classes in the namespace. This is the common pattern used elsewhere in this project, so it's acceptable. However, having them public means they could theoretically conflict with other issue pages if names ever collide.
Looks Good
- Null safety:
(target as ParentingViewController)?.UpdateLeftBarButtonItem()safely handles the case wheretargetis not aParentingViewController. - Null safety:
(n.ViewControllers.FirstOrDefault() as ParentingViewController)?.Childsafely handles empty ViewControllers collection. - Test coverage: UI test added with
VerifyScreenshot()and snapshots for all 4 platforms. - Test structure: Follows established
_IssuesUITestpattern with correct[Category(UITestCategories.FlyoutPage)]. - Minimal fix: The change is only the necessary lines are modified.surgical
- Root cause fix: The
UpdateLeftBarButtonItemchange addresses the underlying issue (stale Pages collection) rather than just working around it.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@Vignesh-SF3580 can you update the iOS snapshot please? |
@kubaflo This PR includes the iOS snapshot, and there are no major concerns from the agent review. |
|
@Vignesh-SF3580 cool! Thanks! |
…ertPageBefore (#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
…ertPageBefore (dotnet#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes dotnet#29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
…ertPageBefore (#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
…ertPageBefore (#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
…ertPageBefore (#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
…ertPageBefore (#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
…ertPageBefore (#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes #29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |
## What's Coming .NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 66 commits with various improvements, bug fixes, and enhancements. ## Activityindicator - [Android] Implemented material3 support for ActivityIndicator by @Dhivya-SF4094 in #33481 <details> <summary>🔧 Fixes</summary> - [Implement material3 support for ActivityIndicator](#33479) </details> - [iOS] Fix: ActivityIndicator IsRunning ignores IsVisible when set to true by @bhavanesh2001 in #28983 <details> <summary>🔧 Fixes</summary> - [[iOS] [ActivityIndicator] `IsRunning` ignores `IsVisible` when set to `true`](#28968) </details> ## Button - [iOS] Button RTL text and image overlap - fix by @kubaflo in #29041 ## Checkbox - [iOS/MacCatalyst] Fix CheckBox foreground color not resetting when set to null by @Ahamed-Ali in #34284 <details> <summary>🔧 Fixes</summary> - [[iOS] Color of the checkBox control is not properly worked on dynamic scenarios](#34278) </details> ## CollectionView - [iOS] Fix: CollectionView does not clear selection when SelectedItem is set to null by @Tamilarasan-Paranthaman in #30420 <details> <summary>🔧 Fixes</summary> - [CollectionView not being able to remove selected item highlight on iOS](#30363) - [[MAUI] Select items traces are preserved](#26187) </details> - [iOS] CV2 ItemsLayout update by @kubaflo in #28675 <details> <summary>🔧 Fixes</summary> - [CollectionView CollectionViewHandler2 doesnt change ItemsLayout on DataTrigger](#28656) - [iOS CollectionView doesn't respect a change to ItemsLayout when using Items2.CollectionViewHandler2](#31259) </details> - [iOS][CV2] Fix CollectionView renders large empty space at bottom of view by @devanathan-vaithiyanathan in #31215 <details> <summary>🔧 Fixes</summary> - [[iOS] [MacCatalyst] CollectionView renders large empty space at bottom of view](#17799) - [[iOS/Mac] CollectionView2 EmptyView takes up large horizontal space even when the content is small](#33201) </details> - [iOS] Fixed issue where group Header/Footer template was set to all items when IsGrouped was true for an ObservableCollection by @Tamilarasan-Paranthaman in #29144 <details> <summary>🔧 Fixes</summary> - [[iOS] Group Header/Footer Repeated for All Items When IsGrouped is True for ObservableCollection in CollectionView](#29141) </details> - [Android] Fix CollectionView selection crash with HeaderTemplate by @NirmalKumarYuvaraj in #34275 <details> <summary>🔧 Fixes</summary> - [[Bug] [Android] System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index](#34247) </details> ## DateTimePicker - [iOS] Fix TimePicker AM/PM frequently changes when the app is closed and reopened by @devanathan-vaithiyanathan in #31066 <details> <summary>🔧 Fixes</summary> - [[iOS] TimePicker AM/PM frequently changes when the app is closed and reopened](#30837) - [Maui 10 iOS TimePicker Strange Characters in place of AM/PM](#33722) </details> - Android TimePicker ignores 24 hour system setting when using Format Property - fix by @kubaflo in #28797 <details> <summary>🔧 Fixes</summary> - [Android TimePicker ignores 24 hour system setting when using Format Property](#28784) </details> ## Drawing - [iOS, Mac, Windows] GraphicsView: Fix Background/BackgroundColor not updating by @NirmalKumarYuvaraj in #31254 <details> <summary>🔧 Fixes</summary> - [[iOS, Mac, Windows] GraphicsView does not change the Background/BackgroundColor](#31239) </details> - [iOS] GraphicsView DrawString - fix by @kubaflo in #26304 <details> <summary>🔧 Fixes</summary> - [DrawString not rendering in iOS.](#24450) - [GraphicsView DrawString not rendering in iOS](#8486) - [DrawString doesn't work on maccatalyst](#4993) </details> - [Android] - Fix Shadow Rendering For Transparent Fill, Stroke (Lines), and Text on Shapes by @prakashKannanSf3972 in #29528 <details> <summary>🔧 Fixes</summary> - [Ellipse Transparency Not Rendered When Drawing Arc Inside the Ellipse Using GraphicsView on Android](#29394) </details> - Revert "[iOS, Mac, Windows] GraphicsView: Fix Background/BackgroundColor not updating (#31254)" by @Ahamed-Ali via @Copilot in #34508 ## Entry - [iOS 26] Fix Entry MaxLength not enforced due to new multi-range delegate by @kubaflo in #32045 <details> <summary>🔧 Fixes</summary> - [iOS 26 - The MaxLength property value is not respected on an Entry control.](#32016) - [.NET MAUI Entry Maximum Length not working on iOS and macOS](#33316) </details> - [iOS] Fixed Entry with IsPassword toggling loses previously entered text by @SubhikshaSf4851 in #30572 <details> <summary>🔧 Fixes</summary> - [Entry with IsPassword toggling loses previously entered text on iOS when IsPassword is re-enabled](#30085) </details> ## Essentials - Fix for FilePicker PickMultipleAsync nullable reference type by @SuthiYuvaraj in #33163 <details> <summary>🔧 Fixes</summary> - [FilePicker PickMultipleAsync nullable reference type](#33114) </details> - Replace deprecated NetworkReachability with NWPathMonitor on iOS/macOS by @jfversluis via @Copilot in #32354 <details> <summary>🔧 Fixes</summary> - [NetworkReachability is obsolete on iOS/maccatalyst 17.4+](#32312) - [Use NWPathMonitor on iOS for Essentials Connectivity](#2574) </details> ## Essentials Connectivity - Update Android Connectivity implementation to use modern APIs by @jfversluis via @Copilot in #30348 <details> <summary>🔧 Fixes</summary> - [Update the Android Connectivity implementation to user modern APIs](#30347) </details> ## Flyout - [iOS] Fixed Flyout icon not updating when root page changes using InsertPageBefore by @Vignesh-SF3580 in #29924 <details> <summary>🔧 Fixes</summary> - [[iOS] Flyout icon not replaced by back button when root page is changed using InsertPageBefore](#29921) </details> ## Flyoutpage - [iOS] Flyout Items Not Displayed in RightToLeft FlowDirection in Landscape - fix by @kubaflo in #26762 <details> <summary>🔧 Fixes</summary> - [Flyout Items Not Displayed in RightToLeft FlowDirection on iOS in Landscape Orientation and Hamburger Icon Positioned Incorrectly](#26726) </details> ## Image - [Android] Implemented Material3 support for Image by @Dhivya-SF4094 in #33661 <details> <summary>🔧 Fixes</summary> - [Implement Material3 support for Image](#33660) </details> ## Keyboard - [iOS] Fix gap at top of view after rotating device while Entry keyboard is visible by @praveenkumarkarunanithi in #34328 <details> <summary>🔧 Fixes</summary> - [Focusing and entering texts on entry control causes a gap at the top after rotating simulator.](#33407) </details> ## Label - [Android] Support for images inside HTML label by @kubaflo in #21679 <details> <summary>🔧 Fixes</summary> - [Label with HTML TextType does not display images on Android](#21044) </details> - [fix] ContentLabel Moved to a nested class to prevent CS0122 in external source generators by @SubhikshaSf4851 in #34514 <details> <summary>🔧 Fixes</summary> - [[MAUI] Building Maui App with sample content results CS0122 errors.](#34512) </details> ## Layout - Optimize ordering of children in Flex layout by @symbiogenesis in #21961 - [Android] Fix control size properties not available during Loaded event by @Vignesh-SF3580 in #31590 <details> <summary>🔧 Fixes</summary> - [CollectionView on Android does not provide height, width, logical children once loaded, works fine on Windows](#14364) - [Control's Loaded event invokes before calling its measure override method.](#14160) </details> ## Mediapicker - [iOS/Android] MediaPicker: Fix image orientation when RotateImage=true by @michalpobuta in #33892 <details> <summary>🔧 Fixes</summary> - [MediaPicker.PickPhotosAsync does not preserve image orientation](#32650) </details> ## Modal - [Windows] Fix modal page keyboard focus not shifting to newly opened modal by @jfversluis in #34212 <details> <summary>🔧 Fixes</summary> - [Keyboard focus does not shift to a newly opened modal page: Pressing enter clicks the button on the page beneath the modal page](#22938) </details> ## Navigation - [iOS26] Apply view margins in title view by @kubaflo in #32205 <details> <summary>🔧 Fixes</summary> - [NavigationPage TitleView iOS 26](#32200) </details> - [iOS] System.NullReferenceException at NavigationRenderer.SetStatusBarStyle() by @kubaflo in #29564 <details> <summary>🔧 Fixes</summary> - [System.NullReferenceException at NavigationRenderer.SetStatusBarStyle()](#29535) </details> - [iOS 26] Fix back button color not applied for NavigationPage by @Shalini-Ashokan in #34326 <details> <summary>🔧 Fixes</summary> - [[iOS] Color not applied to the Back button text or image on iOS 26](#33966) </details> ## Picker - Fix Picker layout on Mac Catalyst 26+ by @kubaflo in #33146 <details> <summary>🔧 Fixes</summary> - [[MacOS 26] Text on picker options are not centered on macOS 26.1](#33229) </details> ## Progressbar - [Android] Implemented Material3 support for ProgressBar by @SyedAbdulAzeemSF4852 in #33926 <details> <summary>🔧 Fixes</summary> - [Implement Material3 support for Progressbar](#33925) </details> ## RadioButton - [iOS, Mac] Fix for RadioButton TextColor for plain Content not working by @HarishwaranVijayakumar in #31940 <details> <summary>🔧 Fixes</summary> - [RadioButton: TextColor for plain Content not working on iOS](#18011) </details> - [All Platforms] Fix RadioButton warning when ControlTemplate is set with View content by @kubaflo in #33839 <details> <summary>🔧 Fixes</summary> - [Seeking clarification on RadioButton + ControlTemplate + Content documentation](#33829) </details> - Visual state change for disabled RadioButton by @kubaflo in #23471 <details> <summary>🔧 Fixes</summary> - [RadioButton disabled UI issue - iOS](#18668) </details> ## SafeArea - [Android] Fix for TabbedPage BottomNavigation BarBackgroundColor not extending to system navigation bar by @praveenkumarkarunanithi in #33428 <details> <summary>🔧 Fixes</summary> - [[Android] TabbedPage BottomNavigation BarBackgroundColor does not extend to system navigation bar area in Edge-to-Edge mode](#33344) </details> ## ScrollView - [Android] ScrollView: Fix HorizontalScrollBarVisibility not updating immediately at runtime by @SubhikshaSf4851 in #33528 <details> <summary>🔧 Fixes</summary> - [Runtime Scrollbar visibility not updating correctly on Android and macOS platforms.](#33400) </details> - Fixed crash when calling ItemsView.ScrollTo on unloaded CollectionView by @kubaflo in #25444 <details> <summary>🔧 Fixes</summary> - [App crashes when calling ItemsView.ScrollTo on unloaded CollectionView](#23014) </details> ## Shell - [Shell] Update logic for iOS large title display in ShellItemRenderer by @kubaflo in #33246 - [iOS][Shell] Fix navigation lifecycle and back button for More tab (>5 tabs) by @kubaflo in #27932 <details> <summary>🔧 Fixes</summary> - [OnAppearing and OnNavigatedTo does not work when using extended Tabbar (tabbar with more than 5 tabs) on IOS.](#27799) - [Shell.BackButtonBehavior does not work when using extended Tabbar (tabbar with more than 5 tabs)on IOS.](#27800) - [Shell TabBar More button causes ViewModel command binding disconnection on back navigation](#30862) - [Content page onappearing not firing if tabs are on the more tab on IOS](#31166) </details> - [iOS 26] Fix tab bar ghosting when navigating from modal to tabbed Shell content by @SubhikshaSf4851 in #34254 <details> <summary>🔧 Fixes</summary> - [[iOS] Tab bar ghosting issue on iOS 26 (liquid glass)](#34143) </details> - Fix for Shell tab visibility not updating when navigating back multiple pages by @BagavathiPerumal in #34403 <details> <summary>🔧 Fixes</summary> - [Changing Shell Tab Visibility when navigating back multiple pages ignores Shell Tab Visibility](#33351) </details> - [iOS/Mac] Fixed OnBackButtonPressed not firing for Shell Navigation Bar Button by @Dhivya-SF4094 in #34401 <details> <summary>🔧 Fixes</summary> - [[iOS] OnBackButtonPressed not firing for Shell Navigation Bar button](#34190) </details> ## Slider - [iOS] Fix for Slider ThumbImageSource is not centered properly on iOS 26 by @HarishwaranVijayakumar in #34019 <details> <summary>🔧 Fixes</summary> - [[iOS 26] Slider ThumbImageSource is not centered properly](#33967) </details> - [Android] Fix improper rendering of ThumbimageSource in Slider by @NirmalKumarYuvaraj in #34064 <details> <summary>🔧 Fixes</summary> - [[Slider] MAUI Slider thumb image is big on android](#13258) </details> ## Stepper - [iOS] Fix Stepper layout overlap in landscape on iOS 26 by @Vignesh-SF3580 in #34325 <details> <summary>🔧 Fixes</summary> - [[.NET10] D10 - Customize cursor position - Rotating simulator makes the button and label overlap](#34273) </details> ## SwipeView - [iOS] SwipeView: Honor FontImageSource.Color in SwipeItem icon by @kubaflo in #27389 <details> <summary>🔧 Fixes</summary> - [[iOS] SwipeView: SwipeItem.IconImageSource.FontImageSource color value not honored](#27377) </details> ## Switch - [Android] Fix Switch thumb shadow missing when ThumbColor is set by @Shalini-Ashokan in #33960 <details> <summary>🔧 Fixes</summary> - [Android Switch Control Thumb Shadow](#19676) </details> ## Toolbar - [iOS/Mac Catalyst 26] Fix Shell.ForegroundColor not applied to ToolbarItems by @SyedAbdulAzeemSF4852 in #34085 <details> <summary>🔧 Fixes</summary> - [[iOS26] Shell.ForegroundColor is not applied to ToolbarItems](#34083) </details> - [Android] VoiceOver on Toolbar Item by @kubaflo in #29596 <details> <summary>🔧 Fixes</summary> - [VoiceOver on Toolbar Item](#29573) - [SemanticProperties do not work on ToolbarItems](#23623) </details> <details> <summary>🧪 Testing (11)</summary> - [Testing] Additional Feature Matrix Test Cases for CollectionView by @TamilarasanSF4853 in #32432 - [Testing] Feature Matrix UITest Cases for VisualStateManager by @LogishaSelvarajSF4525 in #34146 - [Testing] Feature Matrix UITest Cases for Clip by @TamilarasanSF4853 in #34121 - [Testing] Feature matrix UITest Cases for Map Control by @HarishKumarSF4517 in #31656 - [Testing] Feature matrix UITest Cases for Visual Transform Control by @HarishKumarSF4517 in #32799 - [Testing] Feature Matrix UITest Cases for Shell Pages by @NafeelaNazhir in #33945 - [Testing] Feature Matrix UITest Cases for Triggers by @HarishKumarSF4517 in #34152 - [Testing] Refactoring Feature Matrix UITest Cases for CheckBox Control by @LogishaSelvarajSF4525 in #34283 - Resolve UI test Build Sample failures - Candidate March 16 by @Ahamed-Ali in #34442 - Fix the failures in the Candidate branch- March 16 by @Ahamed-Ali in #34453 <details> <summary>🔧 Fixes</summary> - [March 16th, Candidate](#34437) </details> - Fixed the iOS 18.5 Candidate failures (March 16,2026) by @Ahamed-Ali in #34593 <details> <summary>🔧 Fixes</summary> - [March 16th, Candidate](#34437) </details> </details> <details> <summary>📦 Other (2)</summary> - Fixed candidate test failures caused by PR #33428. by @Ahamed-Ali in #34515 <details> <summary>🔧 Fixes</summary> - [[.NET10] On Android, there's a big space at the top for I, M and N2 & N3](#34509) </details> - Revert "[iOS] Button RTL text and image overlap - fix (#29041)" in b0497af </details> <details> <summary>📝 Issue References</summary> Fixes #2574, Fixes #4993, Fixes #8486, Fixes #13258, Fixes #14160, Fixes #14364, Fixes #17799, Fixes #18011, Fixes #18668, Fixes #19676, Fixes #21044, Fixes #22938, Fixes #23014, Fixes #23623, Fixes #24450, Fixes #26187, Fixes #26726, Fixes #27377, Fixes #27799, Fixes #27800, Fixes #28656, Fixes #28784, Fixes #28968, Fixes #29141, Fixes #29394, Fixes #29535, Fixes #29573, Fixes #29921, Fixes #30085, Fixes #30347, Fixes #30363, Fixes #30837, Fixes #30862, Fixes #31166, Fixes #31239, Fixes #31259, Fixes #32016, Fixes #32200, Fixes #32312, Fixes #32650, Fixes #33114, Fixes #33201, Fixes #33229, Fixes #33316, Fixes #33344, Fixes #33351, Fixes #33400, Fixes #33407, Fixes #33479, Fixes #33660, Fixes #33722, Fixes #33829, Fixes #33925, Fixes #33966, Fixes #33967, Fixes #34083, Fixes #34143, Fixes #34190, Fixes #34247, Fixes #34273, Fixes #34278, Fixes #34437, Fixes #34509, Fixes #34512 </details> **Full Changelog**: main...inflight/candidate
…ertPageBefore (dotnet#29924) <!-- 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! ### Issue Detail When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible. ### Root Cause The flyout icon was not updated when changing the root page using InsertPageBefore. ### Description of Change The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead. ### Tested the behavior in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Issues Fixed Fixes dotnet#29921 ### Screenshots | Before Issue Fix | After Issue Fix | |----------|----------| | <video width="300" height="600" src="https://github.com/user-attachments/assets/20acfd44-79af-45c7-ad9d-c55f2e825b49"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/fc99cc8b-8ed2-424f-876c-bd703e10872f">) |

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 Detail
When using the InsertPageBefore method to change the root page in a NavigationPage, the back button is not visible, but the flyout icon remains visible.
Root Cause
The flyout icon was not updated when changing the root page using InsertPageBefore.
Description of Change
The updated logic checks whether the inserted page becomes the new root, updates the flyout icon. Previously, the flyout icon was updated based on NavPageController.Pages. However, this collection was not updated with the actual native navigation stack. Since pages are inserted directly into ViewControllers in InsertPageBefore, the fix updates the flyout icon based on the ViewControllers stack instead.
Tested the behavior in the following platforms
Issues Fixed
Fixes #29921
Screenshots
iOSBeforeFixInsertpage.mov
iOSAfterFixInsertPage.mov