Fix for Shell tab visibility not updating when navigating back multiple pages#34280
Draft
BagavathiPerumal wants to merge 2 commits intodotnet:mainfrom
Draft
Fix for Shell tab visibility not updating when navigating back multiple pages#34280BagavathiPerumal wants to merge 2 commits intodotnet:mainfrom
BagavathiPerumal wants to merge 2 commits intodotnet:mainfrom
Conversation
…rm navigation to ensure Shell TabBar visibility is applied correctly during multi-level back navigation.
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34280Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34280" |
This was referenced Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!
Root cause
The issue occurs because of the navigation sequence used in OnPopToRootAsync() where the platform navigation is triggered before the root page’s lifecycle events are fired. When Shell.Current.GoToAsync("../..") is used, the method InvokeNavigationRequest() executes first, which sends the navigation request to the native platform handlers.
The platform then commits the UI changes immediately. Only after this process, the root page’s OnAppearing() method is called. Since Shell.SetTabBarIsVisible() is typically invoked inside OnAppearing(), it runs too late, after the UI has already been rendered, causing the TabBar visibility change to be ignored.
This timing mismatch does not occur with single-level navigation (GoToAsync("..")) because that flow correctly triggers lifecycle events before the platform navigation begins.
Description of Issue Fix
The fix involves reordering the execution sequence within OnPopToRootAsync() so that PresentedPageAppearing() runs before InvokeNavigationRequest(), ensuring OnAppearing() is triggered early enough for updates such as Shell.SetTabBarIsVisible() to be applied before the platform finalizes the navigation UI.
Additionally, the stack cleanup loop was refined to skip calling SendDisappearing() on the top page since it is already handled by PresentedPageDisappearing(), thereby avoiding duplicate lifecycle events while still notifying intermediate pages. This change aligns multi level pop to root behavior with single level pop, providing consistent lifecycle handling without introducing breaking changes.
Tested the behavior in the following platforms.
Issues Fixed
Fixes #33351
Output
33351-BeforeFix.mov
33351-AfterFix.mov