Skip to content

Fix TitleView covering content in iOS 26+ Shell#32337

Closed
kubaflo wants to merge 1 commit intodotnet:mainfrom
kubaflo:fix-32287
Closed

Fix TitleView covering content in iOS 26+ Shell#32337
kubaflo wants to merge 1 commit intodotnet:mainfrom
kubaflo:fix-32287

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Nov 2, 2025

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 of Change

Adjusts TitleViewContainer to use autoresizing masks and sets the frame for iOS 26+ and Mac Catalyst 26+ to prevent the custom TitleView from covering Shell content. Adds a test case and UI test for Issue 32287 to verify the fix.

Before After

Issues Fixed

Fixes #32287

Adjusts TitleViewContainer to use autoresizing masks and sets the frame for iOS 26+ and Mac Catalyst 26+ to prevent the custom TitleView from covering Shell content. Adds a test case and UI test for Issue 32287 to verify the fix.
Copilot AI review requested due to automatic review settings November 2, 2025 14:04
@kubaflo kubaflo self-assigned this Nov 2, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 2, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR attempts to fix an issue where custom TitleView in AppShell causes shell content to be covered on iOS. The implementation adds special handling for what is incorrectly labeled as "iOS 26+" by using autoresizing masks instead of constraints for the TitleView container.

  • Adds conditional logic to handle TitleView display differently for a specific iOS version
  • Creates a new constructor overload for TitleViewContainer that accepts navigationBarFrame
  • Includes a UI test to verify the custom TitleView does not cover content

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Issue32287.cs NUnit test implementation to verify custom TitleView doesn't cover content
Issue32287.xaml.cs Code-behind for Shell test page with iOS platform specification
Issue32287.xaml XAML defining Shell with custom TitleView and test content
ShellPageRendererTracker.cs Core fix implementing version-specific TitleView container logic

Copilot AI added a commit that referenced this pull request Nov 2, 2025
- Added CreateTitleViewContainer helper method to reduce code duplication
- Improved iOS 26+ detection with proper fallback when navigation bar frame unavailable
- Set frame origin to (0,0) instead of preserving potentially uninitialized X/Y values
- Added comprehensive XML documentation explaining iOS 26 workaround
- Added test case and UI test for Issue32287

This implementation addresses the critical issues identified in PR #32337 review:
- Eliminates silent failure by providing fallback to standard constructor
- Clarifies frame positioning logic with explicit (0,0) origin
- Reduces code duplication through helper method
- Adds proper documentation for maintainability

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

public void CustomTitleViewDoesNotCoverContent()
{
App.WaitForElement("Label");
VerifyScreenshot();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending snapshots already available in the latest build:

Image

Could you commit the images?

@PureWeen
Copy link
Member

PureWeen commented Nov 3, 2025

closing in favor of
#32341

@PureWeen PureWeen closed this Nov 3, 2025
github-actions bot pushed a commit that referenced this pull request Nov 21, 2025
- Added CreateTitleViewContainer helper method to reduce code duplication
- Improved iOS 26+ detection with proper fallback when navigation bar frame unavailable
- Set frame origin to (0,0) instead of preserving potentially uninitialized X/Y values
- Added comprehensive XML documentation explaining iOS 26 workaround
- Added test case and UI test for Issue32287

This implementation addresses the critical issues identified in PR #32337 review:
- Eliminates silent failure by providing fallback to standard constructor
- Clarifies frame positioning logic with explicit (0,0) origin
- Reduces code duplication through helper method
- Adds proper documentation for maintainability

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Nov 21, 2025
- Added CreateTitleViewContainer helper method to reduce code duplication
- Improved iOS 26+ detection with proper fallback when navigation bar frame unavailable
- Set frame origin to (0,0) instead of preserving potentially uninitialized X/Y values
- Added comprehensive XML documentation explaining iOS 26 workaround
- Added test case and UI test for Issue32287

This implementation addresses the critical issues identified in PR #32337 review:
- Eliminates silent failure by providing fallback to standard constructor
- Clarifies frame positioning logic with explicit (0,0) origin
- Reduces code duplication through helper method
- Adds proper documentation for maintainability

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
PureWeen added a commit that referenced this pull request Nov 21, 2025
… and NavigationPage (#32798)

* Initial plan

* Implement improved fix for iOS 26 TitleView covering content issue

- Added CreateTitleViewContainer helper method to reduce code duplication
- Improved iOS 26+ detection with proper fallback when navigation bar frame unavailable
- Set frame origin to (0,0) instead of preserving potentially uninitialized X/Y values
- Added comprehensive XML documentation explaining iOS 26 workaround
- Added test case and UI test for Issue32287

This implementation addresses the critical issues identified in PR #32337 review:
- Eliminates silent failure by providing fallback to standard constructor
- Clarifies frame positioning logic with explicit (0,0) origin
- Reduces code duplication through helper method
- Adds proper documentation for maintainability

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* Apply iOS 26 TitleView fix to NavigationPage

Extended the iOS 26+ TitleView fix to NavigationPage in addition to Shell:

1. Added CreateTitleViewContainer helper method to centralize container creation
2. Added Container constructor overload accepting navigation bar frame for iOS 26+
3. Refactored Container initialization to use InitializeContainer method
4. Updated ToolbarHeight to use actual navigation bar height when available
5. Eliminated hardcoded 44pt height assumption for iOS 26+

This ensures both Shell and NavigationPage TitleView implementations handle iOS 26 layout changes consistently, preventing TitleView from covering page content.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* Enhance Issue32287 test with rotation and dynamic content size changes

Extended the Issue32287 test based on review feedback:

1. Added rotation test to verify TitleView behavior in landscape mode
2. Added dynamic font size change tests to verify container tracks nav bar changes
3. Added buttons to increase/decrease TitleView font size
4. Added x:Name to TitleLabel for programmatic access
5. Created placeholder snapshot image for test validation
6. Wrapped rotation tests with TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST

Tests now comprehensively verify that TitleView container correctly tracks
navigation bar frame changes without covering content in all scenarios.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* - update tests

* Add NavigationPage equivalent tests for Issue32287

Created comprehensive NavigationPage tests mirroring the Shell tests:

1. Issue32287NavigationPage.xaml - NavigationPage with custom TitleView
2. Issue32287NavigationPage.xaml.cs - Code-behind with font size controls
3. Issue32287NavigationPage.cs - UI tests matching Shell test scenarios:
   - Basic test verifying TitleView doesn't cover content
   - Dynamic content size change test
   - Landscape rotation test (iOS/Android only)
4. Created placeholder snapshot image for visual validation

Tests verify that the NavigationPage Container fix handles iOS 26+ layout
changes consistently with Shell, preventing TitleView from covering content.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* Fix NavigationPage XAML structure and add platform-specific comments

Fixed XAML parsing error and addressed PR review feedback:

1. Changed Issue32287NavigationPage from NavigationPage to ContentPage
   - NavigationPage cannot have content directly set in XAML
   - NavigationPage.TitleView is an attached property set on ContentPage
   - Updated base class from NavigationPage to ContentPage

2. Added explanatory comments for platform-specific conditionals
   - Documented that rotation tests only work on iOS/Android
   - Explained SetOrientationLandscape/Portrait not supported on Windows/Catalyst
   - Applied to both Issue32287 and Issue32287NavigationPage test files

Fixes XAML error: "Cannot set the content of NavigationPage as it doesn't
have a ContentPropertyAttribute"

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* - fix navigation page

* Delete src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/CustomTitleViewDoesNotCoverContent.png

* Delete src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue32287NavigationPageCustomTitleViewDoesNotCoverContent.png

* - fix tests and add suggested fix

* Remove all test files from PR

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>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
PureWeen added a commit that referenced this pull request Nov 21, 2025
…2341)

* Initial plan

* Implement improved fix for iOS 26 TitleView covering content issue

- Added CreateTitleViewContainer helper method to reduce code duplication
- Improved iOS 26+ detection with proper fallback when navigation bar frame unavailable
- Set frame origin to (0,0) instead of preserving potentially uninitialized X/Y values
- Added comprehensive XML documentation explaining iOS 26 workaround
- Added test case and UI test for Issue32287

This implementation addresses the critical issues identified in PR #32337 review:
- Eliminates silent failure by providing fallback to standard constructor
- Clarifies frame positioning logic with explicit (0,0) origin
- Reduces code duplication through helper method
- Adds proper documentation for maintainability

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* Apply iOS 26 TitleView fix to NavigationPage

Extended the iOS 26+ TitleView fix to NavigationPage in addition to Shell:

1. Added CreateTitleViewContainer helper method to centralize container creation
2. Added Container constructor overload accepting navigation bar frame for iOS 26+
3. Refactored Container initialization to use InitializeContainer method
4. Updated ToolbarHeight to use actual navigation bar height when available
5. Eliminated hardcoded 44pt height assumption for iOS 26+

This ensures both Shell and NavigationPage TitleView implementations handle iOS 26 layout changes consistently, preventing TitleView from covering page content.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* Enhance Issue32287 test with rotation and dynamic content size changes

Extended the Issue32287 test based on review feedback:

1. Added rotation test to verify TitleView behavior in landscape mode
2. Added dynamic font size change tests to verify container tracks nav bar changes
3. Added buttons to increase/decrease TitleView font size
4. Added x:Name to TitleLabel for programmatic access
5. Created placeholder snapshot image for test validation
6. Wrapped rotation tests with TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST

Tests now comprehensively verify that TitleView container correctly tracks
navigation bar frame changes without covering content in all scenarios.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* - update tests

* Add NavigationPage equivalent tests for Issue32287

Created comprehensive NavigationPage tests mirroring the Shell tests:

1. Issue32287NavigationPage.xaml - NavigationPage with custom TitleView
2. Issue32287NavigationPage.xaml.cs - Code-behind with font size controls
3. Issue32287NavigationPage.cs - UI tests matching Shell test scenarios:
   - Basic test verifying TitleView doesn't cover content
   - Dynamic content size change test
   - Landscape rotation test (iOS/Android only)
4. Created placeholder snapshot image for visual validation

Tests verify that the NavigationPage Container fix handles iOS 26+ layout
changes consistently with Shell, preventing TitleView from covering content.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* Fix NavigationPage XAML structure and add platform-specific comments

Fixed XAML parsing error and addressed PR review feedback:

1. Changed Issue32287NavigationPage from NavigationPage to ContentPage
   - NavigationPage cannot have content directly set in XAML
   - NavigationPage.TitleView is an attached property set on ContentPage
   - Updated base class from NavigationPage to ContentPage

2. Added explanatory comments for platform-specific conditionals
   - Documented that rotation tests only work on iOS/Android
   - Explained SetOrientationLandscape/Portrait not supported on Windows/Catalyst
   - Applied to both Issue32287 and Issue32287NavigationPage test files

Fixes XAML error: "Cannot set the content of NavigationPage as it doesn't
have a ContentPropertyAttribute"

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>

* - fix navigation page

* Delete src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/CustomTitleViewDoesNotCoverContent.png

* Delete src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue32287NavigationPageCustomTitleViewDoesNotCoverContent.png

* - fix tests and add suggested fix

* Remove all test files from PR

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>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-controls-titleview TitleView community ✨ Community Contribution platform/ios version/iOS-26

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using custom TitleView in AppShell causes shell content to be covered in iOS 26

4 participants