diff --git a/src/Controls/src/Core/NavigationPage/NavigationPage.cs b/src/Controls/src/Core/NavigationPage/NavigationPage.cs index 414ff519e821..8bf135510018 100644 --- a/src/Controls/src/Core/NavigationPage/NavigationPage.cs +++ b/src/Controls/src/Core/NavigationPage/NavigationPage.cs @@ -402,9 +402,6 @@ void FireAppearing(Page page) void RemoveFromInnerChildren(Element page) { InternalChildren.Remove(page); - - // TODO For NET9 we should remove this because the DisconnectHandlers will take care of it - page.Handler = null; } void SafePop() diff --git a/src/Controls/tests/DeviceTests/Elements/FlyoutPage/FlyoutPageTests.cs b/src/Controls/tests/DeviceTests/Elements/FlyoutPage/FlyoutPageTests.cs index 0fa98ee5b1f2..1380ee9974ed 100644 --- a/src/Controls/tests/DeviceTests/Elements/FlyoutPage/FlyoutPageTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/FlyoutPage/FlyoutPageTests.cs @@ -46,25 +46,6 @@ void SetupBuilder() }); } - [Theory] - [ClassData(typeof(FlyoutPageLayoutBehaviorTestCases))] - public async Task PoppingFlyoutPageDoesntCrash(Type flyoutPageType) - { - SetupBuilder(); - var navPage = new NavigationPage(new ContentPage()) { Title = "App Page" }; - - await CreateHandlerAndAddToWindow(new Window(navPage), async (handler) => - { - var flyoutPage = CreateFlyoutPage( - flyoutPageType, - new NavigationPage(new ContentPage() { Content = new Border(), Title = "Detail" }), - new ContentPage() { Title = "Flyout" }); - - await navPage.PushAsync(flyoutPage); - await navPage.PopAsync(); - }); - } - [Theory] [ClassData(typeof(FlyoutPageLayoutBehaviorTestCases))] public async Task SwappingDetailPageWorksForSplitFlyoutBehavior(Type flyoutPageType) diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FlyoutPageNavigation.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FlyoutPageNavigation.png new file mode 100644 index 000000000000..2df4141ae9a1 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FlyoutPageNavigation.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue10274.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue10274.cs new file mode 100644 index 000000000000..ecad3d8a6484 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue10274.cs @@ -0,0 +1,80 @@ +namespace Maui.Controls.Sample.Issues +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + [Issue(IssueTracker.Github, 10274, "MAUI Flyout does not work on Android when not using Shell", PlatformAffected.Android)] + public class Issue10274 : NavigationPage + { + public Issue10274() : base(new MainPage()) + { + + } + + public class MainPage : ContentPage + { + public MainPage() + { + var button = new Button + { + Text = "Navigate to Flyout Page", + AutomationId = "button" + }; + + button.Clicked += OnNavigateToFlyoutPageClicked; + + Content = new StackLayout + { + Padding = new Thickness(20), + Children = { button } + }; + } + private async void OnNavigateToFlyoutPageClicked(object sender, EventArgs e) + { + await Navigation.PushAsync(new CustomFlyoutPage()); + } + } + + public class CustomFlyoutPage : FlyoutPage + { + public CustomFlyoutPage() + { + Flyout = new ContentPage + { + Title = "Flyout", + Content = new StackLayout + { + Padding = new Thickness(20), + Children = + { + new Label { Text = "This is the Flyout page." } + } + } + }; + + var button = new Button + { + Text = "Go Back", + AutomationId = "flyoutPageButton" + }; + button.Clicked += OnGoBackClicked; + + var detailPage = new ContentPage + { + Title = "Detail", + Content = new StackLayout + { + Padding = new Thickness(20), + + Children = { button } + } + }; + + Detail = new NavigationPage(detailPage); + } + + private async void OnGoBackClicked(object sender, EventArgs e) + { + await Navigation.PopAsync(); + } + } + } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10274.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10274.cs new file mode 100644 index 000000000000..a82116df3c61 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10274.cs @@ -0,0 +1,31 @@ +#if !MACCATALYST +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue10274 : _IssuesUITest + { + public Issue10274(TestDevice device): base(device) + { + } + + public override string Issue => "MAUI Flyout does not work on Android when not using Shell"; + + [Test] + [Category(UITestCategories.FlyoutPage)] + public void FlyoutPageNavigation() + { + App.WaitForElement("button"); + App.Tap("button"); + + App.WaitForElement("flyoutPageButton"); + App.Tap("flyoutPageButton"); + + App.WaitForElement("button"); + VerifyScreenshot(); + } + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FlyoutPageNavigation.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FlyoutPageNavigation.png new file mode 100644 index 000000000000..ef1e0393abc4 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/FlyoutPageNavigation.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FlyoutPageNavigation.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FlyoutPageNavigation.png new file mode 100644 index 000000000000..1ff7f1351402 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/FlyoutPageNavigation.png differ