Skip to content

Flyout page in Android does not show flyout button (burger) consistently #24468

@guyvaio

Description

@guyvaio

Description

The condition to show the flyout button (burger) or not is set in method ShouldShowToolbarButton of the FlyoutPage.
In Android, this method is not hit when orientation changes. This method is only called once during initialization.
Test is done with a physical Android tablet running MAUI 8.0.90-dev.

Under iOS, rotation of an iPad triggers correctly method ShouldShowToolbarButton.

The default code of ShouldShowToolbarButton of depends on the orientation. It’s inconsistent not to trigger this code after rotation.

public virtual bool ShouldShowToolbarButton()
{
	if (DeviceInfo.Idiom == DeviceIdiom.Phone)
		return true;

	FlyoutLayoutBehavior behavior = FlyoutLayoutBehavior;
	var orientation = DeviceDisplay.MainDisplayInfo.Orientation;

	bool isSplitOnLandscape = (behavior == FlyoutLayoutBehavior.SplitOnLandscape || behavior == FlyoutLayoutBehavior.Default) && orientation.IsLandscape();
	bool isSplitOnPortrait = behavior == FlyoutLayoutBehavior.SplitOnPortrait && orientation.IsPortrait();
	return behavior != FlyoutLayoutBehavior.Split && !isSplitOnLandscape && !isSplitOnPortrait;
}

Steps to Reproduce

  1. Create an MAUI app for MAUI 8.0
  2. For simplification purposes, set TargetFrameworks to net8.0-android only
  3. Set a FlyoutPage as the MainPage
  4. Set a simple ContentPage as Flyout of the MainPage
  5. Set a NavigationPage as Detail of the MainPage

Link to public reproduction project repository

No response

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12.0

Did you find any workaround?

Modification of source code in Maui-main\src\Controls\src\Core\NavigationPage\NavigationPageToolbar.cs

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions