-
Notifications
You must be signed in to change notification settings - Fork 2k
[iOS 26] NavigationPage.TitleView resizing on iOS 26+ rotation - Fix #32815
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,41 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue32722" | ||
| Title="Issue 32722"> | ||
|
|
||
| <NavigationPage.TitleView> | ||
| <Grid x:Name="TitleViewGrid" | ||
| BackgroundColor="LightBlue" | ||
| HorizontalOptions="FillAndExpand" | ||
| AutomationId="TitleViewGrid"> | ||
| <Label Text="TitleView Test" | ||
| x:Name="TitleLabel" | ||
| AutomationId="TitleLabel" | ||
| TextColor="White" | ||
| FontSize="18" | ||
| FontAttributes="Bold" | ||
| VerticalOptions="Center" | ||
| HorizontalOptions="Center"/> | ||
| </Grid> | ||
| </NavigationPage.TitleView> | ||
|
|
||
| <VerticalStackLayout Padding="20" Spacing="10"> | ||
| <Label Text="Issue #32722 Test" | ||
| FontSize="20" | ||
| FontAttributes="Bold" | ||
| AutomationId="HeaderLabel" | ||
| HorizontalOptions="Center"/> | ||
|
|
||
| <Label Text="This test verifies that NavigationPage.TitleView expands when the window/orientation changes on iOS 26+." | ||
| FontSize="14" | ||
| AutomationId="DescriptionLabel"/> | ||
|
|
||
| <Label x:Name="StatusLabel" | ||
| Text="Rotate device to test" | ||
| AutomationId="StatusLabel" | ||
| FontSize="16" | ||
| TextColor="Gray" | ||
| Margin="0,20,0,0"/> | ||
| </VerticalStackLayout> | ||
| </ContentPage> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 32722, "NavigationPage.TitleView does not expand with host window in iPadOS 26+", PlatformAffected.iOS)] | ||
| public class Issue32722NavPage : NavigationPage | ||
| { | ||
| public Issue32722NavPage() : base(new Issue32722()) | ||
| { | ||
| } | ||
| } | ||
|
|
||
| public partial class Issue32722 : ContentPage | ||
| { | ||
| public Issue32722() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,54 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using NUnit.Framework; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using UITest.Appium; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using UITest.Core; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class Issue32722 : _IssuesUITest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public override string Issue => "NavigationPage.TitleView does not expand with host window in iPadOS 26+"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public Issue32722(TestDevice device) : base(device) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Category(UITestCategories.Navigation)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void TitleViewExpandsOnRotation() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Wait for page to load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| App.WaitForElement("TitleViewGrid"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| App.WaitForElement("StatusLabel"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Get initial orientation and TitleView bounds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var titleViewInitial = App.WaitForElement("TitleViewGrid").GetRect(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var initialWidth = titleViewInitial.Width; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| App.SetOrientationLandscape(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Wait for rotation to complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| System.Threading.Thread.Sleep(2000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Get TitleView bounds after rotation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var titleViewAfterRotation = App.WaitForElement("TitleViewGrid").GetRect(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var newWidth = titleViewAfterRotation.Width; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // On iOS 26+, the TitleView should expand/contract with the rotation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // The bug was that it would stay at the original width | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // After fix, the width should change to match the new navigation bar width | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Assert.That(newWidth, Is.Not.EqualTo(initialWidth).Within(100), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "TitleView width should change after rotation"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Verify TitleView is still visible and has reasonable dimensions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Assert.That(newWidth, Is.GreaterThan(100), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "TitleView should have a reasonable width after rotation"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Rotate back to original orientation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| App.SetOrientationPortrait(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| System.Threading.Thread.Sleep(2000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Verify TitleView returns to approximately original width | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var titleViewFinal = App.WaitForElement("TitleViewGrid").GetRect(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Assert.That(titleViewFinal.Width, Is.EqualTo(initialWidth).Within(5), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "TitleView should return to original width after rotating back"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+46
to
+52
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| System.Threading.Thread.Sleep(2000); | |
| // Verify TitleView returns to approximately original width | |
| var titleViewFinal = App.WaitForElement("TitleViewGrid").GetRect(); | |
| Assert.That(titleViewFinal.Width, Is.EqualTo(initialWidth).Within(5), | |
| "TitleView should return to original width after rotating back"); | |
| } | |
| WaitForTitleViewWidth("TitleViewGrid", initialWidth, tolerance: 5, timeoutMs: 3000); | |
| // Verify TitleView returns to approximately original width | |
| var titleViewFinal = App.WaitForElement("TitleViewGrid").GetRect(); | |
| Assert.That(titleViewFinal.Width, Is.EqualTo(initialWidth).Within(5), | |
| "TitleView should return to original width after rotating back"); | |
| } | |
| /// <summary> | |
| /// Waits until the TitleView's width is within the specified tolerance of the expected value, or until timeout. | |
| /// </summary> | |
| private void WaitForTitleViewWidth(string automationId, double expectedWidth, double tolerance, int timeoutMs) | |
| { | |
| var start = DateTime.UtcNow; | |
| while ((DateTime.UtcNow - start).TotalMilliseconds < timeoutMs) | |
| { | |
| var rect = App.WaitForElement(automationId).GetRect(); | |
| if (Math.Abs(rect.Width - expectedWidth) <= tolerance) | |
| return; | |
| System.Threading.Thread.Sleep(100); | |
| } | |
| // Final check after timeout | |
| var finalRect = App.WaitForElement(automationId).GetRect(); | |
| if (Math.Abs(finalRect.Width - expectedWidth) > tolerance) | |
| { | |
| Assert.Fail($"TitleView width did not return to expected value within {timeoutMs}ms. Expected: {expectedWidth}, Actual: {finalRect.Width}"); | |
| } | |
| } |
Uh oh!
There was an error while loading. Please reload this page.