Skip to content

Fix Shell Android navigation icon flicker during push/pop animation - #1

Draft
Dreamescaper with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-navigation-icon-visibility
Draft

Fix Shell Android navigation icon flicker during push/pop animation#1
Dreamescaper with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-navigation-icon-visibility

Conversation

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown

On Android Shell with a Flyout, pushing a page causes the hamburger icon to briefly appear during the animation before switching to the back arrow once the animation completes. The same flicker occurs on pop.

Root Cause

PR dotnet#28187 (Issue21646 fix) introduced a regression in ShellToolbarTracker.UpdateLeftBarButtonItem. The icon-setup conditions were changed to use backButtonVisible = _toolbar.BackButtonVisible, but this value is copied from the global toolbar at OnCreateView time — which reflects the previous (root) page's stale state (BackButtonVisible = false). The global toolbar isn't updated until shell.Navigated fires after the animation completes.

Fix

Replace backButtonVisible with backButtonVisibleFromBehavior in the four icon-setup conditions in ShellToolbarTracker.cs:

// backButtonVisibleFromBehavior reads directly from BackButtonBehavior.IsVisibleProperty
// on the destination page — correct at fragment creation time, before the toolbar syncs

if (icon == null && (_flyoutBehavior == FlyoutBehavior.Flyout || (CanNavigateBack && backButtonVisibleFromBehavior)))
icon?.Progress = (CanNavigateBack && backButtonVisibleFromBehavior) ? 1 : 0;
if (command != null || (CanNavigateBack && backButtonVisibleFromBehavior))
    if (backButtonVisibleFromBehavior || !defaultDrawerArrowDrawable)
        toolbar.NavigationIcon = icon;

Both variables agree after navigation completes, so post-animation behavior is unchanged. The Issue21646 case (BackButtonBehavior.IsVisible = false → hamburger stays visible) continues to work correctly.

…tead of backButtonVisible in ShellToolbarTracker

Agent-Logs-Url: https://github.com/Dreamescaper/maui/sessions/060e5fa4-1693-4b26-be73-469dffa70d0a

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants