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
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,20 @@ void OnToolbarPropertyChanged(object? sender, PropertyChangedEventArgs e)

protected virtual void UpdateTitle()
{
if (!ToolbarReady() || NavigationItem is null || _context?.Shell?.Toolbar is null)

if (NavigationItem is null)
{
return;
}

if (ToolbarReady() && _context?.Shell?.Toolbar is not null)
{
NavigationItem.Title = _context.Shell.Toolbar.Title;
return;
}

NavigationItem.Title = _context.Shell.Toolbar.Title;
// Update back-stack pages so iOS back button/history menu reflects title changes
NavigationItem.Title = Page?.Title;
}


Expand Down
67 changes: 67 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue35471.cs
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))

Copy link
Copy Markdown
Collaborator

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.

Comment thread
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");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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 "Accueil"; it does not exercise the history-menu path named by the issue, and it remains dependent on native accessibility exposing the back-button title. Since the supplied gate already failed unexpectedly and the test has to skip iOS 26 for this exact accessibility reason, this is likely too brittle as the sole regression. Please either validate the native history-menu/back-stack title through a deterministic device-test hook, or make the UI test explicitly cover only the supported visible-back-button scenario and add a lower-level assertion for UINavigationItem.Title.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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 Home -> Detail, the test can pass without ever opening or validating the history menu path. Please make the repro stack deep enough to show a back-history menu and use the existing long-press pattern (App.LongPress("Back")) to assert/select the updated history item.

App.Tap("Accueil");
App.WaitForElement("RootPageLabel");
}
}
}
#endif
Loading