Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 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!

Fix Window Insets on Android API < 30 (NavigationPage and Shell)

Description

This PR addresses window insets issues on Android versions below API 30 (Android 11) affecting both Shell and NavigationPage navigation. The fix implements Google's workaround for the inset dispatch bug present in Android API 28 and API 29.

Title clipping issue on Android API 28

Changes Made

1. NavigationRootManager.cs

Added ViewGroupCompat.InstallCompatInsetsDispatch() for API < 30 to ensure window insets are properly dispatched to all children recursively. This implements Google's workaround for the inset dispatch bug where one child consuming insets blocks all siblings from receiving them.

Issue: On Android API < 30, when one view consumes window insets, sibling views don't receive them, causing content to be clipped by system UI (status bar, navigation bar, etc.). This affects both Shell navigation and NavigationPage with hidden navigation bars.

Defensive Programming: Added null check and logging for _rootView to help with future debugging and prevent potential null reference exceptions. Uses _mauiContext?.CreateLogger()?.LogWarning() with the proper Microsoft.Extensions.Logging using directive for logging integration.

if(!OperatingSystem.IsAndroidVersionAtLeast(30))
{
    // Dispatches insets to all children recursively (for API < 30)
    // This implements Google's workaround for the API 28-29 inset dispatch bug
    // where one child consuming insets blocks all siblings from receiving them.
    // Based on: https://android-review.googlesource.com/c/platform/frameworks/support/+/3310617
    if (_rootView is null)
    {
        _mauiContext?.CreateLogger()?.LogWarning(
            "NavigationRootManager: _rootView is null when attempting to install compat insets dispatch. " +
            "This may cause incorrect window insets behavior on API < 30.");
    }
    else
    {
        ViewGroupCompat.InstallCompatInsetsDispatch(_rootView);
    }
}

2. Test Case (Issue32526)

  • Creates a Shell application with navigation between pages
  • Navigates to a new page using Navigation.PushAsync()
  • Verifies content positioning by comparing top label positions on both pages
  • Ensures labels are positioned below the toolbar (not clipped)
  • Includes assertions to verify correct Y positioning

Affected Android Versions

  • Android 9 (API 28) - Pie
  • Android 10 (API 29) - Q
  • All versions below API 30

Affected Scenarios

  • Shell navigation: Title and back button clipping on navigated pages
  • NavigationPage with hidden nav bar: Top and bottom content clipping

Issues Fixed

Fixes #32526

Original prompt

Please backport the following PR #32537


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Backport changes from PR 32537 to stable branch Backport #32537: Fix Shell title clipping on Android API 28-29 Nov 19, 2025
Copilot AI requested a review from PureWeen November 19, 2025 13:01
@PureWeen
Copy link
Member

@copilot can you please update the title and descripton to better reflect the changes

Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot can you please update the title and descripton to better reflect the changes

Updated the PR title to "Fix Shell content page title clipping on Android API 28-29" and revised the description to better describe the actual changes and root cause. The description now focuses on what this PR accomplishes rather than framing it as a backport reference.

Copilot AI changed the title Backport #32537: Fix Shell title clipping on Android API 28-29 Fix Shell content page title clipping on Android API 28-29 Nov 19, 2025
@PureWeen
Copy link
Member

@copilot

Update title and description to match

#32537

@PureWeen PureWeen marked this pull request as ready for review November 19, 2025 17:58
Copilot AI review requested due to automatic review settings November 19, 2025 17:58
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot

Update title and description to match ...

Updated the PR title to "Fix content page title clipping on Android API < 30 with window insets compatibility" and description to match PR #32537, including the detailed explanation of affected Android versions (API < 30), affected scenarios (both Shell and NavigationPage), and the comprehensive technical details.

Copilot AI changed the title Fix Shell content page title clipping on Android API 28-29 Fix content page title clipping on Android API < 30 with window insets compatibility Nov 19, 2025
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 fixes Shell navigation page titles being clipped under the system UI on Android 9 (API 28) and Android 10 (API 29) by applying Google's AndroidX workaround for the insets dispatch bug in those API versions.

Key Changes

  • Applies ViewGroupCompat.InstallCompatInsetsDispatch() for Android API < 30 to ensure all children receive window insets
  • Adds null-checking and logging for cases where _rootView is null
  • Includes comprehensive UI test verifying Shell navigation title positioning across page navigation

Reviewed Changes

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

File Description
src/Core/src/Platform/Android/Navigation/NavigationRootManager.cs Implements compat insets dispatch for API < 30 with proper null-checking and logging
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32526.cs Adds NUnit test verifying Shell navigation page titles are not clipped
src/Controls/tests/TestCases.HostApp/Issues/Issue32526.xaml.cs Provides test page implementation with Shell and navigation pages
src/Controls/tests/TestCases.HostApp/Issues/Issue32526.xaml Defines Shell container for test pages

@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@PureWeen PureWeen merged commit 00c60b3 into release/10.0.1xx-sr1 Nov 19, 2025
11 of 15 checks passed
@PureWeen PureWeen deleted the copilot/backport-pr-32537 branch November 19, 2025 21:28
evgenygunko pushed a commit to evgenygunko/CopyWordsDA that referenced this pull request Nov 26, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [Microsoft.Maui.Controls](https://github.com/dotnet/maui) | nuget | patch | `10.0.10` -> `10.0.11` |

---

### Release Notes

<details>
<summary>dotnet/maui (Microsoft.Maui.Controls)</summary>

### [`v10.0.11`](https://github.com/dotnet/maui/releases/tag/10.0.11): SR1.1

[Compare Source](dotnet/maui@10.0.10...10.0.11)

##### What's Changed

.NET MAUI 10.0.11 introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 11 commits with various improvements, bug fixes, and enhancements.

##### .NET MAUI Product Fixes

##### Android

-   Fix content page title clipping on Android API < 30 with window insets compatibility by [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#32738

    <details>
    <summary>🔧 Fixes</summary>

    -   [Shell content page title position incorrect/clipped](dotnet/maui#32526)

    </details>

##### Button

-   \[release/10.0.1xx-sr1] Removed Value property coercion in RadioButton by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32604

    <details>
    <summary>🔧 Fixes</summary>

    -   [Removed Value property coercion in RadioButton](dotnet/maui#32489)

    </details>

##### DateTimePicker

-   Fix crash when TimePicker.Time is set to null (backport from PR [#&#8203;32660](dotnet/maui#32660)) by [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#32715

    <details>
    <summary>🔧 Fixes</summary>

    -   [Fix crash when TimePicker.Time is set to null](dotnet/maui#32660)

    </details>

##### Gestures

-   \[release/10.0.1xx-sr1] predictive back gesture support for Android 13+ by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32635

    <details>
    <summary>🔧 Fixes</summary>

    -   [predictive back gesture support for Android 13+](dotnet/maui#32461)

    </details>

##### Infrastructure

-   \[release/10.0.1xx-sr1] \[ci] Revert changes setting Creator by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32803

    <details>
    <summary>🔧 Fixes</summary>

    -   [\[ci\] Revert changes setting Creator](dotnet/maui#32743)

    </details>

##### Mediapicker

-   \[release/10.0.1xx-sr1] \[Android] Refactor selection limit handling in MediaPicker by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32628

    <details>
    <summary>🔧 Fixes</summary>

    -   [\[Android\] Refactor selection limit handling in MediaPicker](dotnet/maui#32571)

   ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants