Repository navigation
[iOS, Mac] Fix Shell back button history menu does not update after runtime change #35542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 35471, "iOS Shell back button history menu does not update after runtime culture change", PlatformAffected.iOS | PlatformAffected.macOS)] | ||
| public class Issue35471 : TestShell | ||
| { | ||
| ContentPage _rootPage; | ||
|
|
||
| protected override void Init() | ||
| { | ||
| _rootPage = CreateContentPage("HomePage"); | ||
| _rootPage.Title = "Home"; | ||
|
|
||
| var navigateButton = new Button | ||
| { | ||
| AutomationId = "NavigateToDetail", | ||
| Text = "Go to Detail Page", | ||
| Command = new Command(async () => | ||
| { | ||
| await Navigation.PushAsync(new Issue35471DetailPage(_rootPage)); | ||
| }) | ||
| }; | ||
|
|
||
| _rootPage.Content = new VerticalStackLayout | ||
| { | ||
| Padding = 20, | ||
| Spacing = 10, | ||
| Children = | ||
| { | ||
| new Label { Text = "Root Page", AutomationId = "RootPageLabel" }, | ||
| navigateButton | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| class Issue35471DetailPage : ContentPage | ||
| { | ||
| readonly ContentPage _previousPage; | ||
|
|
||
| public Issue35471DetailPage(ContentPage previousPage) | ||
| { | ||
| _previousPage = previousPage; | ||
| Title = "Detail"; | ||
|
|
||
| var changeTitleButton = new Button | ||
| { | ||
| AutomationId = "ChangePreviousPageTitle", | ||
| Text = "Change Previous Page Title (simulate culture change)", | ||
| Command = new Command(() => | ||
| { | ||
| // Simulate runtime culture change by updating the previous page's title | ||
| _previousPage.Title = "Accueil"; | ||
| }) | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Padding = 20, | ||
| Spacing = 10, | ||
| Children = | ||
| { | ||
| new Label { Text = "Detail Page", FontSize = 20 }, | ||
| changeTitleButton | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // iOS/MacCatalyst only: The fix updates UINavigationItem.Title for back-stack pages, | ||
| // which iOS uses to display the back button text. This is an Apple platform-specific behavior. | ||
| #if IOS || MACCATALYST | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue35471 : _IssuesUITest | ||
| { | ||
| public override string Issue => "iOS Shell back button history menu does not update after runtime culture change"; | ||
|
|
||
| public Issue35471(TestDevice device) : base(device) | ||
| { | ||
| } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| public void ShellBackButtonHistoryUpdatesAfterTitleChange() | ||
| { | ||
| // iOS 26+ no longer exposes the back button title text via accessibility, | ||
| // so there is no reliable way to assert the updated title in a UI test. | ||
| if (App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp)) | ||
|
HarishwaranVijayakumar marked this conversation as resolved.
Resolved
|
||
| { | ||
| Assert.Ignore("iOS 26+ does not expose back button title text via accessibility"); | ||
| } | ||
|
|
||
| // Navigate to Detail page | ||
| App.WaitForElement("NavigateToDetail"); | ||
| App.Tap("NavigateToDetail"); | ||
|
|
||
| // Change the previous page's title (simulates runtime culture change) | ||
| App.WaitForElement("ChangePreviousPageTitle"); | ||
| App.Tap("ChangePreviousPageTitle"); | ||
|
|
||
| // Verify back button now shows updated title "Accueil" | ||
| // Without the fix, UINavigationItem.Title is stale and still shows "Home" | ||
| App.WaitForElement("Accueil"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [moderate] Regression Prevention and Test Coverage — The regression test only waits for/taps the visible back button text
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [moderate] Regression Prevention — This asserts the visible back button text on a two-page stack, but the reported regression is the iOS long-press back-history menu. With only |
||
| App.Tap("Accueil"); | ||
| App.WaitForElement("RootPageLabel"); | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention — The issue was reported on iOS 26 and specifically affects the long-press back-history menu, but this test skips iOS 26 entirely and only asserts the visible two-page back button text via accessibility. That can pass while the reported history menu remains stale on the affected OS. Please add coverage that exercises the reported scenario on iOS 26, e.g. a lower-level/handler test that inspects the
UINavigationItem/back item title used by the history menu, or an automation path that opens the long-press menu instead of skipping the affected platform.