-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix AppBarLayout insets when FlyoutPage is pushed modally on Android #32379
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
Conversation
|
@copilot , This issue occurs only if the flyout page is wrapped inside modal page. No issue if we directly load the FlyoutPage. |
|
@copilot , When a FlyoutPage is pushed modally, the listener is triggered for the ContainerView. Normally, insets are processed using a CoordinatorLayout-based approach. However, when the ContainerView becomes the root view of the modal flyout, the insets for the CoordinatorLayout are skipped. |
Implemented the ContainerView early return approach in 3622f9c. This simpler solution passes insets through to child views, allowing the CoordinatorLayout to handle them correctly without needing recursive search. |
|
@copilot , Remove the unwanted refactoring changes. |
|
@copilot , The test case added seems incorrect. Create a UI Test case for this scenario and with Issue32277 as IssueID. The test page Issue32277 should be a content page. That should contain a button. In the button click, Push the flyoutPage modally. Restrict this test case in desktop platforms. public partial class Issue32277 : ContentPage
{
public Issue32277()
{
Button button = new Button
{
Text = "Go to Issue32277 Page"
};
button.Clicked += async (s, e) =>
{
await Navigation.PushModalAsync(new Issue32277_FlyoutPage());
};
Content = new StackLayout
{
Children =
{
button
}
};
}
}
public class Issue32277_FlyoutPage : FlyoutPage
{
public Issue32277_FlyoutPage()
{
Flyout = new ContentPage
{
Title = "Flyout",
Content = new StackLayout
{
Children =
{
new Label { Text = "This is the flyout page." }
}
}
};
Detail = new NavigationPage(new ContentPage());
}
} |
Replaced the DeviceTest with UI Test in 61460bb. Created Issue32277.cs in both TestCases.HostApp (test page with button to push FlyoutPage modally) and TestCases.Shared.Tests (UI test restricted to Android and iOS platforms using |
| @@ -0,0 +1,33 @@ | |||
| #if ANDROID || IOS // Exclude desktop platforms (Windows, MacCatalyst) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot , replace App.WaitForElement("DetailLabel", "Detail page should be visible with proper insets"); with VerifyScreenshot().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in e3adbcc. Replaced App.WaitForElement("DetailLabel", "Detail page should be visible with proper insets") with VerifyScreenshot() for visual verification of proper AppBarLayout insets.
There was a problem hiding this 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 an issue where modal FlyoutPages don't receive proper window insets on Android, causing the AppBarLayout to render behind system UI elements. The fix adds a special case in the GlobalWindowInsetListener to pass insets through to child views when the view is a ContainerView.
Key changes:
- Modified window inset handling to allow ContainerView to pass insets to its children
- Added UI test coverage for modal FlyoutPage scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/src/Platform/Android/GlobalWindowInsetListener.cs | Added check to pass insets through ContainerView to child views (e.g., CoordinatorLayout) |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32277.cs | Added NUnit test to verify modal FlyoutPage receives proper AppBarLayout insets |
| src/Controls/tests/TestCases.HostApp/Issues/Issue32277.cs | Added HostApp UI page demonstrating modal FlyoutPage inset issue |
| @@ -0,0 +1,33 @@ | |||
| #if ANDROID || IOS // Exclude desktop platforms (Windows, MacCatalyst) | |||
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This platform directive unnecessarily restricts the test. According to the UI Testing Guidelines (CodingGuidelineID: 1000002), tests should run on all applicable platforms by default unless there is a specific technical limitation. The HostApp code-behind specifies PlatformAffected.Android, which suggests this is primarily an Android issue, but the test infrastructure will handle platform filtering automatically. Unless FlyoutPage modal navigation has known issues on iOS/Windows/MacCatalyst that would cause the test to fail, this directive should be removed to allow the test to run on all platforms.
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
…search Co-authored-by: NirmalKumarYuvaraj <[email protected]> # Conflicts: # src/Core/src/Platform/Android/GlobalWindowInsetListener.cs
Co-authored-by: NirmalKumarYuvaraj <[email protected]>
…tement Co-authored-by: NirmalKumarYuvaraj <[email protected]>
Co-authored-by: NirmalKumarYuvaraj <[email protected]>
Co-authored-by: NirmalKumarYuvaraj <[email protected]>
d8a69f2 to
88707e6
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Fix AppBarLayout insets when FlyoutPage is pushed modally on Android
Summary
When a FlyoutPage is pushed modally, the AppBarLayout doesn't receive window insets, causing the navigation bar to render behind system UI elements.
Root Cause
Modal FlyoutPage hierarchy is
ContainerView > DrawerLayout > NavigationRoot > AppBarLayout. When the listener is triggered for the ContainerView wrapper, the insets need to pass through to allow the CoordinatorLayout inside to handle them correctly.Changes
This minimal approach allows the standard inset handling to work correctly on the child CoordinatorLayout without any refactoring.
Testing
#if ANDROID || IOSFixes #32277
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.