Fix iOS 26 TitleView covering content in Shell and NavigationPage#32341
Fix iOS 26 TitleView covering content in Shell and NavigationPage#32341
Conversation
|
@copilot Implement my own fix based on my review insights and write a PR description for that new implementation |
Implemented an improved fix based on the review insights in commit 66e1443. Key improvements over PR #32337:
The solution maintains the core approach (autoresizing masks for iOS 26+) but addresses the robustness and maintainability concerns identified in the review. |
|
@copilot Currently, this change only affects the Shell navigation bar’s TitleView. However, in .NET MAUI developers can also define a TitleView for a standard NavigationPage, like this: I recommend applying a similar fix to this implementation as well. |
1 similar comment
|
@copilot Currently, this change only affects the Shell navigation bar’s TitleView. However, in .NET MAUI developers can also define a TitleView for a standard NavigationPage, like this: I recommend applying a similar fix to this implementation as well. |
... Applied the iOS 26 fix to NavigationPage TitleView in commit b802459. Changes made:
Both Shell and NavigationPage now handle iOS 26+ TitleView layout consistently using autoresizing masks and actual navigation bar dimensions. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@copilot, nice job on the navigation page
|
|
|
||
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| public void CustomTitleViewDoesNotCoverContent() |
There was a problem hiding this comment.
Can extend the Issue32287 test? Include a rotation test (portrait/landscape) and a dynamic TitleView content size change (e.g., larger font) to verify the container’s frame tracks nav bar changes without covering content
There was a problem hiding this comment.
@copilot
Can extend the Issue32287 test? Include a rotation test (portrait/landscape) and a dynamic TitleView content size change (e.g., larger font) to verify the container’s frame tracks nav bar changes without covering content
There was a problem hiding this comment.
Extended the Issue32287 test in commit 2579564:
- Rotation test -
CustomTitleViewDoesNotCoverContentInLandscape()verifies TitleView behavior in landscape mode - Dynamic content tests -
CustomTitleViewTracksContentSizeChanges()verifies container adapts when TitleView font size changes - Interactive controls - Added buttons to increase/decrease title font size
- TearDown - Properly resets orientation after tests
All rotation tests are wrapped with TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST since orientation changes only work on mobile platforms.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32287.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
@copilot these tests look good!
Can you create an equivalent version of these tests for NavigationPage?
There was a problem hiding this comment.
Created NavigationPage equivalent tests in commit 5ee5063:
Test Files Created:
Issue32287NavigationPage.xaml- NavigationPage with custom TitleView and interactive controlsIssue32287NavigationPage.xaml.cs- Code-behind with font size adjustment methodsIssue32287NavigationPage.cs- UI tests with three test methods:CustomTitleViewDoesNotCoverContent()- Basic verificationCustomTitleViewTracksContentSizeChanges()- Dynamic content size testCustomTitleViewDoesNotCoverContentInLandscape()- Rotation test (iOS/Android)
- Placeholder snapshot image for visual validation
The NavigationPage tests mirror the Shell test structure and verify the Container fix handles iOS 26+ layout changes consistently.
Deleted all Issue32287 test files as requested: - Issue32287.xaml and Issue32287.xaml.cs (Shell tests) - Issue32287NavigationPage.xaml and Issue32287NavigationPage.xaml.cs (NavigationPage tests) - Issue32287.cs and Issue32287NavigationPage.cs (UI test implementations) The PR now contains only the iOS 26 TitleView fix implementation without test coverage. Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Deleted all test files in commit e248773: Removed files:
The PR now contains only the iOS 26 TitleView fix implementation for Shell and NavigationPage without test coverage. Updated the PR description to remove all test-related sections. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/backport to release/10.0.1xx-sr1 |
|
Started backporting to |
|
Fixes dotnet#32899 The regression was introduced in PR dotnet#32341 where the Height property was set on the TitleViewContainer for iOS 26+. This interfered with the UIContainerView's layout logic, preventing images from rendering properly in Shell.TitleView. The fix removes the Height property assignment while keeping the Frame setting, which is sufficient for proper sizing with autoresizing masks. Changes: - Removed Height property assignment in TitleViewContainer constructor - Added UI test case Issue32899 to verify TitleView images display correctly
Fixes dotnet#32899 The regression was introduced in PR dotnet#32341 where the Height property was set on the TitleViewContainer for iOS 26+. This interfered with the UIContainerView's layout logic, preventing images from rendering properly in Shell.TitleView. The fix removes the Height property assignment while keeping the Frame setting, which is sufficient for proper sizing with autoresizing masks. Changes: - Removed Height property assignment in TitleViewContainer constructor - Added UI test case Issue32899 to verify TitleView images display correctly
Fixes dotnet#32899 The regression was introduced in PR dotnet#32341 where the Height property was set on the TitleViewContainer for iOS 26+. This interfered with the UIContainerView's layout logic, preventing images from rendering properly in Shell.TitleView. The fix removes the Height property assignment while keeping the Frame setting, which is sufficient for proper sizing with autoresizing masks. Changes: - Removed Height property assignment in TitleViewContainer constructor - Added UI test case Issue32899 to verify TitleView images display correctly
…26.1 (#32913) * Fix TitleView image not showing on iOS 26 and macOS 26.1 Fixes #32899 The regression was introduced in PR #32341 where the Height property was set on the TitleViewContainer for iOS 26+. This interfered with the UIContainerView's layout logic, preventing images from rendering properly in Shell.TitleView. The fix removes the Height property assignment while keeping the Frame setting, which is sufficient for proper sizing with autoresizing masks. Changes: - Removed Height property assignment in TitleViewContainer constructor - Added UI test case Issue32899 to verify TitleView images display correctly * Fix TitleView image not showing on iOS 26 and macOS 26.1 * Add UpdateTitleViewInternal for iOS 26+ compatibility Introduces UpdateTitleViewInternal in ShellPageRendererTracker and calls it from ShellSectionRenderer for iOS 26+ and Mac Catalyst 26+. This ensures TitleView is updated correctly when the ViewController is added to a NavigationController, addressing layout issues on newer OS versions.


Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Fixes custom TitleView covering page content on iOS 26 by switching from Auto Layout constraints to autoresizing masks. On iOS 26+, the navigation bar layout behavior changed, causing TitleView containers using constraints to expand beyond the navigation bar bounds and cover the underlying content, making it uninteractable.
Root Cause
iOS 26 changed how navigation bar title views are laid out. When using Auto Layout constraints (the approach for iOS 11-25), the TitleView container expands beyond the navigation bar bounds and covers the shell/page content below.
Solution
For iOS 26+ and MacCatalyst 26+:
Changes Made
Shell TitleViewContainer (
ShellPageRendererTracker.cs)CreateTitleViewContainerhelper method for centralized container creationNavigationPage Container (
NavigationRenderer.cs)CreateTitleViewContainerhelper method matching Shell implementationInitializeContainermethodToolbarHeightproperty to use actual nav bar height (eliminates hardcoded 44pt)Technical Details
iOS Version Handling
Frame Management
Issues Fixed
Fixes #32287
Fixes #32777
Related Issues
Similar iOS version-specific TitleView fixes: #31831, #31701, #20959 (iOS 16), #12834
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.