From f4bad654a2869ff4c7c28382ff6be57617b035c8 Mon Sep 17 00:00:00 2001 From: SuthiYuvaraj <92777079+SuthiYuvaraj@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:56:40 +0530 Subject: [PATCH 1/5] Update NavigationRenderer.cs --- .../NavigationPage/iOS/NavigationRenderer.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs index a120b1cdee601..f562c6ea487b9 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs @@ -1607,7 +1607,18 @@ public override void ViewWillTransitionToSize(SizeF toSize, IUIViewControllerTra base.ViewWillTransitionToSize(toSize, coordinator); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) + { UpdateLeftBarButtonItem(); + + // For iOS 26+, force TitleView to re-layout on window size changes (iPad Stage Manager) + if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26)) + { + coordinator.AnimateAlongsideTransition(_ => + { + UpdateTitleViewFrameForOrientation(); + }, null); + } + } } public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) @@ -1641,7 +1652,6 @@ void UpdateTitleViewFrameForOrientation() titleView.Frame = new RectangleF(0, 0, navigationBarFrame.Width, navigationBarFrame.Height); titleView.LayoutIfNeeded(); } - internal void UpdateLeftBarButtonItem(Page pageBeingRemoved = null) { NavigationRenderer n; From 550938a3fa8c9a83d49134395df3773959fd74a6 Mon Sep 17 00:00:00 2001 From: SuthiYuvaraj <92777079+SuthiYuvaraj@users.noreply.github.com> Date: Tue, 9 Dec 2025 20:16:20 +0530 Subject: [PATCH 2/5] testcases --- .../TestCases.HostApp/Issues/Issue32722.cs | 72 ++++++++++++++ .../Tests/Issues/Issue32722.cs | 97 +++++++++---------- 2 files changed, 120 insertions(+), 49 deletions(-) create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs new file mode 100644 index 0000000000000..35f1a23b82d6f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs @@ -0,0 +1,72 @@ +namespace Maui.Controls.Sample.Issues +{ + [Issue(IssueTracker.Github, 32722, "NavigationPage.TitleView does not expand with host window in iPadOS 26+", PlatformAffected.iOS)] + public class Issue32722 : NavigationPage + { + public Issue32722() : base(new Issue32722ContentPage()) + { + } + } + + public class Issue32722ContentPage : ContentPage + { + public Issue32722ContentPage() + { + Title = "Issue 32722"; + + // Create TitleView with a Grid containing a Label + var titleViewLabel = new Label + { + Text = "TitleView Test", + AutomationId = "TitleLabel", + TextColor = Colors.White, + FontSize = 18, + FontAttributes = FontAttributes.Bold, + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = LayoutOptions.Center + }; + + var titleViewGrid = new Grid + { + AutomationId = "TitleViewGrid", + BackgroundColor = Colors.LightBlue, + HorizontalOptions = LayoutOptions.FillAndExpand, + Children = { titleViewLabel } + }; + + NavigationPage.SetTitleView(this, titleViewGrid); + + // Create content + Content = new VerticalStackLayout + { + Padding = 20, + Spacing = 10, + Children = + { + new Label + { + Text = "Issue #32722 Test", + FontSize = 20, + FontAttributes = FontAttributes.Bold, + AutomationId = "HeaderLabel", + HorizontalOptions = LayoutOptions.Center + }, + new Label + { + Text = "This test verifies that NavigationPage.TitleView expands when the window/orientation changes on iOS 26+.", + FontSize = 14, + AutomationId = "DescriptionLabel" + }, + new Label + { + Text = "Rotate device to test", + AutomationId = "StatusLabel", + FontSize = 16, + TextColor = Colors.Gray, + Margin = new Thickness(0, 20, 0, 0) + } + } + }; + } + } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs index 04db152c95d9e..4d3d1a1d48f1b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs @@ -1,56 +1,55 @@ -#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST // The test fails on Windows and MacCatalyst because the SetOrientation method, which is intended to change the device orientation, is only supported on mobile platforms iOS and Android. - 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"); - } - } + 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) { } + + // NOTE: This test case only fails on iPad with iOS 26.1+ + // The bug does not occur on earlier iOS versions + [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(1000); + + // 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(); + + // 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"); + } + } } -#endif \ No newline at end of file From fc4fffa0383714002a9df504e14dc87393e5fcbf Mon Sep 17 00:00:00 2001 From: SuthiYuvaraj <92777079+SuthiYuvaraj@users.noreply.github.com> Date: Wed, 10 Dec 2025 18:19:03 +0530 Subject: [PATCH 3/5] Testcases already added --- .../TestCases.HostApp/Issues/Issue32722.cs | 72 ------------------- .../Tests/Issues/Issue32722.cs | 55 -------------- 2 files changed, 127 deletions(-) delete mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs delete mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs deleted file mode 100644 index 35f1a23b82d6f..0000000000000 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace Maui.Controls.Sample.Issues -{ - [Issue(IssueTracker.Github, 32722, "NavigationPage.TitleView does not expand with host window in iPadOS 26+", PlatformAffected.iOS)] - public class Issue32722 : NavigationPage - { - public Issue32722() : base(new Issue32722ContentPage()) - { - } - } - - public class Issue32722ContentPage : ContentPage - { - public Issue32722ContentPage() - { - Title = "Issue 32722"; - - // Create TitleView with a Grid containing a Label - var titleViewLabel = new Label - { - Text = "TitleView Test", - AutomationId = "TitleLabel", - TextColor = Colors.White, - FontSize = 18, - FontAttributes = FontAttributes.Bold, - VerticalOptions = LayoutOptions.Center, - HorizontalOptions = LayoutOptions.Center - }; - - var titleViewGrid = new Grid - { - AutomationId = "TitleViewGrid", - BackgroundColor = Colors.LightBlue, - HorizontalOptions = LayoutOptions.FillAndExpand, - Children = { titleViewLabel } - }; - - NavigationPage.SetTitleView(this, titleViewGrid); - - // Create content - Content = new VerticalStackLayout - { - Padding = 20, - Spacing = 10, - Children = - { - new Label - { - Text = "Issue #32722 Test", - FontSize = 20, - FontAttributes = FontAttributes.Bold, - AutomationId = "HeaderLabel", - HorizontalOptions = LayoutOptions.Center - }, - new Label - { - Text = "This test verifies that NavigationPage.TitleView expands when the window/orientation changes on iOS 26+.", - FontSize = 14, - AutomationId = "DescriptionLabel" - }, - new Label - { - Text = "Rotate device to test", - AutomationId = "StatusLabel", - FontSize = 16, - TextColor = Colors.Gray, - Margin = new Thickness(0, 20, 0, 0) - } - } - }; - } - } -} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs deleted file mode 100644 index 4d3d1a1d48f1b..0000000000000 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs +++ /dev/null @@ -1,55 +0,0 @@ -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) { } - - // NOTE: This test case only fails on iPad with iOS 26.1+ - // The bug does not occur on earlier iOS versions - [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(1000); - - // 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(); - - // 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"); - } - } -} From bd2a1453b8ac55303969273b5491c77db455cb10 Mon Sep 17 00:00:00 2001 From: SuthiYuvaraj <92777079+SuthiYuvaraj@users.noreply.github.com> Date: Wed, 10 Dec 2025 18:19:03 +0530 Subject: [PATCH 4/5] Testcases already added --- .../TestCases.HostApp/Issues/Issue32722.cs | 72 -------------- .../Tests/Issues/Issue32722.cs | 97 ++++++++++--------- 2 files changed, 49 insertions(+), 120 deletions(-) delete mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs deleted file mode 100644 index 35f1a23b82d6f..0000000000000 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue32722.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace Maui.Controls.Sample.Issues -{ - [Issue(IssueTracker.Github, 32722, "NavigationPage.TitleView does not expand with host window in iPadOS 26+", PlatformAffected.iOS)] - public class Issue32722 : NavigationPage - { - public Issue32722() : base(new Issue32722ContentPage()) - { - } - } - - public class Issue32722ContentPage : ContentPage - { - public Issue32722ContentPage() - { - Title = "Issue 32722"; - - // Create TitleView with a Grid containing a Label - var titleViewLabel = new Label - { - Text = "TitleView Test", - AutomationId = "TitleLabel", - TextColor = Colors.White, - FontSize = 18, - FontAttributes = FontAttributes.Bold, - VerticalOptions = LayoutOptions.Center, - HorizontalOptions = LayoutOptions.Center - }; - - var titleViewGrid = new Grid - { - AutomationId = "TitleViewGrid", - BackgroundColor = Colors.LightBlue, - HorizontalOptions = LayoutOptions.FillAndExpand, - Children = { titleViewLabel } - }; - - NavigationPage.SetTitleView(this, titleViewGrid); - - // Create content - Content = new VerticalStackLayout - { - Padding = 20, - Spacing = 10, - Children = - { - new Label - { - Text = "Issue #32722 Test", - FontSize = 20, - FontAttributes = FontAttributes.Bold, - AutomationId = "HeaderLabel", - HorizontalOptions = LayoutOptions.Center - }, - new Label - { - Text = "This test verifies that NavigationPage.TitleView expands when the window/orientation changes on iOS 26+.", - FontSize = 14, - AutomationId = "DescriptionLabel" - }, - new Label - { - Text = "Rotate device to test", - AutomationId = "StatusLabel", - FontSize = 16, - TextColor = Colors.Gray, - Margin = new Thickness(0, 20, 0, 0) - } - } - }; - } - } -} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs index 4d3d1a1d48f1b..04db152c95d9e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32722.cs @@ -1,55 +1,56 @@ +#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST // The test fails on Windows and MacCatalyst because the SetOrientation method, which is intended to change the device orientation, is only supported on mobile platforms iOS and Android. + 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) { } - - // NOTE: This test case only fails on iPad with iOS 26.1+ - // The bug does not occur on earlier iOS versions - [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(1000); - - // 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(); - - // 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"); - } - } + 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"); + } + } } +#endif \ No newline at end of file From 9d67ddf6eeea28add3ad28c12a2ab337ffa03ccf Mon Sep 17 00:00:00 2001 From: SuthiYuvaraj <92777079+SuthiYuvaraj@users.noreply.github.com> Date: Tue, 17 Feb 2026 10:18:06 +0530 Subject: [PATCH 5/5] Update NavigationRenderer.cs --- .../Handlers/NavigationPage/iOS/NavigationRenderer.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs index 1ee9e3cf5a8b8..c15f89aaf5a68 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs @@ -1602,6 +1602,10 @@ UIImage GetEmptyBackIndicatorImage() return empty; } + /// + /// Called when the view controller's view transitions to a new size. + /// On iPad iOS 26+, manually updates TitleView frame to handle Stage Manager window resizing. + /// public override void ViewWillTransitionToSize(SizeF toSize, IUIViewControllerTransitionCoordinator coordinator) { base.ViewWillTransitionToSize(toSize, coordinator); @@ -1610,7 +1614,8 @@ public override void ViewWillTransitionToSize(SizeF toSize, IUIViewControllerTra { UpdateLeftBarButtonItem(); - // For iOS 26+, force TitleView to re-layout on window size changes (iPad Stage Manager) + // For iOS 26+, force TitleView to re-layout on window size changes (iPad Stage Manager, multitasking) + // Complements TraitCollectionDidChange handling (device rotation) added in #32815 if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26)) { coordinator.AnimateAlongsideTransition(_ =>