Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Controls/src/Core/ShellToolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ internal void ApplyChanges()
backButtonVisible = _backButtonBehavior.IsVisible;
}

_drawerToggleVisible = stack.Count <= 1;
var flyoutBehavior = (_shell as IFlyoutView).FlyoutBehavior;
_drawerToggleVisible = stack.Count <= 1 && flyoutBehavior is FlyoutBehavior.Flyout;
BackButtonVisible = backButtonVisible && stack.Count > 1;
BackButtonEnabled = _backButtonBehavior?.IsEnabled ?? true;
ToolbarItems = _toolbarTracker.ToolbarItems;
Expand All @@ -103,7 +104,6 @@ internal void ApplyChanges()
if (_shell.IsSet(Shell.NavBarIsVisibleProperty))
return (bool)_shell.GetValue(Shell.NavBarIsVisibleProperty);

var flyoutBehavior = (_shell as IFlyoutView).FlyoutBehavior;
#if WINDOWS
return (!String.IsNullOrEmpty(Title) ||
TitleView != null ||
Expand Down
51 changes: 51 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue27337.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 27337, "Flyout with FlyoutBehavior='Locked' unlocks (reverts to Flyout) after navigation", PlatformAffected.UWP)]
public class Issue27337 : TestShell
{
protected override void Init()
{
ContentPage MainPage = new ContentPage
{
Title = "Home",
Content = new VerticalStackLayout
{
Children =
{
new Button
{
AutomationId = "SecondPageButton",
Text = "Navigate to Second Page",
HorizontalOptions = LayoutOptions.Fill,
Command = new Command(() => Shell.Current.GoToAsync("Issue27337_SecondPage"))
}
}
}
};

FlyoutBehavior = FlyoutBehavior.Locked;

Items.Add(new FlyoutItem
{
Title = "Home",
Items =
{
new ShellContent
{
Content = MainPage
}
}
});

Routing.RegisterRoute("Issue27337_SecondPage", typeof(Issue27337_SecondPage));
}
}

public class Issue27337_SecondPage : ContentPage
{
public Issue27337_SecondPage()
{
Title = "Second Page";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue27337 : _IssuesUITest
{
public override string Issue => "Flyout with FlyoutBehavior='Locked' unlocks (reverts to Flyout) after navigation";

public Issue27337(TestDevice device) : base(device)
{
}

[Test]
[Category(UITestCategories.Shell)]
public void EnsureFlyoutBehaviourAsLockedAfterNavigation()
{
App.WaitForElement("SecondPageButton");
App.Tap("SecondPageButton");
App.Back();
VerifyNoFlyoutIconAfterBackNavigation();
}

void VerifyNoFlyoutIconAfterBackNavigation()
{
#if ANDROID
App.WaitForNoElement(AppiumQuery.ByXPath("//android.widget.ImageButton[@content-desc=\"Open navigation drawer\"]"));
#elif IOS || MACCATALYST
App.WaitForNoElement("OK");
#elif WINDOWS
App.WaitForNoElement(AppiumQuery.ByAccessibilityId("TogglePaneButton"));
#endif
}
}
}
Loading