diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml new file mode 100644 index 000000000000..aac6bcca0c2a --- /dev/null +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs new file mode 100644 index 000000000000..260cd69e0ec6 --- /dev/null +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20199.xaml.cs @@ -0,0 +1,29 @@ +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Xaml; + +namespace Maui.Controls.Sample.Issues +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + [Issue(IssueTracker.Github, 20199, "[iOS] Page titles do not appear until navigating when pushing a modal page at startup", PlatformAffected.iOS)] + public partial class Issue20199 : Shell + { + public Issue20199() + { + InitializeComponent(); + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + + var closeModalPageButton = new Button() { Text = "Hide", AutomationId = "button" }; + closeModalPageButton.Clicked += (s, e) => Navigation.PopAsync(); + + var modalPage = new ContentPage() { Content = closeModalPageButton }; + + await Navigation.PushModalAsync(modalPage); + } + } + + public class Issue20199Page : ContentPage { } +} \ No newline at end of file diff --git a/src/Controls/src/Core/Shell/ShellSection.cs b/src/Controls/src/Core/Shell/ShellSection.cs index b88e977c22f4..9778bc5acebd 100644 --- a/src/Controls/src/Core/Shell/ShellSection.cs +++ b/src/Controls/src/Core/Shell/ShellSection.cs @@ -648,8 +648,11 @@ internal void UpdateDisplayedPage() if (previousPage != DisplayedPage) { previousPage?.SendDisappearing(); - PresentedPageAppearing(); - SendAppearanceChanged(); + if (!Navigation.ModalStack.Any()) + { + PresentedPageAppearing(); + SendAppearanceChanged(); + } } } diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue20199.cs b/src/Controls/tests/UITests/Tests/Issues/Issue20199.cs new file mode 100644 index 000000000000..3599b45bb34e --- /dev/null +++ b/src/Controls/tests/UITests/Tests/Issues/Issue20199.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.AppiumTests.Issues +{ + public class Issue20199 : _IssuesUITest + { + public override string Issue => "[iOS] Page titles do not appear until navigating when pushing a modal page at startup"; + + public Issue20199(TestDevice device) : base(device) + { + } + + [Test] + public void TitleViewShouldBeVisible() + { + this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }); + + _ = App.WaitForElement("button"); + App.Click("button"); + + // The test passes if the 'Home Page' title is visible + VerifyScreenshot(); + } + } +} diff --git a/src/Controls/tests/UITests/snapshots/ios/TitleViewShouldBeVisible.png b/src/Controls/tests/UITests/snapshots/ios/TitleViewShouldBeVisible.png new file mode 100644 index 000000000000..8dd518b8c84a Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/ios/TitleViewShouldBeVisible.png differ