-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix content page title clipping on Android API < 30 with window insets compatibility #32537
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
de12750
Initial plan
Copilot 6607f64
- Apply fix for emulators with APIs less than 30
PureWeen 203699b
Use OperatingSystem.IsAndroidVersionAtLeast(30) for API version check
Copilot e50bfa0
- fix tests
PureWeen 7043580
- container
PureWeen 60f607e
- Apply API 28 Workaround
PureWeen fb5f67d
- switched implementation to google compat method
PureWeen 74b5447
Revert changes to ShellContentFragment, ShellItemRenderer, and ShellP…
Copilot fe1649f
Revert changes to common-testing-patterns.md and MauiWindowInsetListe…
Copilot ab9d422
Revert changes to NavigationRootManager.cs
Copilot ee8766b
Revert "Revert changes to NavigationRootManager.cs"
Copilot c630d2e
Add defensive logging and validation for null _rootView
Copilot ce4d727
Rename test files from Issue32278 to Issue32526 to match GitHub issue…
Copilot cae5345
Fix compilation error: use CreateLogger instead of non-existent Loggi…
Copilot 5d7a751
Add Microsoft.Extensions.Logging using directive for LogWarning exten…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Controls/tests/TestCases.HostApp/Issues/Issue32526.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| xmlns:local="clr-namespace:Maui.Controls.Sample.Issues" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue32526" | ||
| Title="Issue32526"> | ||
|
|
||
| <ShellContent ContentTemplate="{DataTemplate local:Issue32526MainPage}" /> | ||
|
|
||
| </Shell> |
79 changes: 79 additions & 0 deletions
79
src/Controls/tests/TestCases.HostApp/Issues/Issue32526.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 32526, "Shell content page title position incorrect/clipped", PlatformAffected.Android)] | ||
| public partial class Issue32526 : Shell | ||
| { | ||
| public Issue32526() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } | ||
|
|
||
| public class Issue32526MainPage : ContentPage | ||
| { | ||
| public Issue32526MainPage() | ||
| { | ||
| Title = "MainPage"; | ||
|
|
||
| // Add a top label on the main page to compare position with the second page | ||
| var topLabel = new Label | ||
| { | ||
| Text = "Top Label - Page 1", | ||
| AutomationId = "TopLabelPage1", | ||
| BackgroundColor = Colors.LightBlue, | ||
| HorizontalOptions = LayoutOptions.Fill, | ||
| VerticalOptions = LayoutOptions.Start, | ||
| Padding = 10 | ||
| }; | ||
|
|
||
| var button = new Button | ||
| { | ||
| Text = "Navigate to Page 2", | ||
| AutomationId = "NavigateButton" | ||
| }; | ||
|
|
||
| button.Clicked += async (s, e) => | ||
| { | ||
| await Navigation.PushAsync(new Issue32526NewPage()); | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Spacing = 10, | ||
| Children = | ||
| { | ||
| topLabel, | ||
| button | ||
| } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| public class Issue32526NewPage : ContentPage | ||
| { | ||
| public Issue32526NewPage() | ||
| { | ||
| Title = "Page 2"; | ||
|
|
||
| // Add a label at the top to help verify that content is positioned correctly | ||
| // If SafeAreaEdges is not working, content will be clipped under the toolbar | ||
| var topLabel = new Label | ||
| { | ||
| Text = "Top Label - Page 2", | ||
| AutomationId = "TopLabelPage2", | ||
| BackgroundColor = Colors.Yellow, | ||
| HorizontalOptions = LayoutOptions.Fill, | ||
| VerticalOptions = LayoutOptions.Start, | ||
| Padding = 10 | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Spacing = 10, | ||
| Children = | ||
| { | ||
| topLabel | ||
| } | ||
| }; | ||
| } | ||
| } |
48 changes: 48 additions & 0 deletions
48
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32526.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue32526 : _IssuesUITest | ||
| { | ||
| public Issue32526(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Shell content page title position incorrect/clipped"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| public void ShellNavigationPageTitleNotClipped() | ||
| { | ||
| // Wait for the main page to load | ||
| App.WaitForElement("NavigateButton"); | ||
| App.WaitForElement("TopLabelPage1"); | ||
|
|
||
| // Get the position of the top label on Page 1 | ||
| var topLabelPage1 = App.FindElement("TopLabelPage1"); | ||
| var rectPage1 = topLabelPage1.GetRect(); | ||
|
|
||
| // Navigate to the new page | ||
| App.Tap("NavigateButton"); | ||
|
|
||
| // Wait for the second page to appear | ||
| App.WaitForElement("TopLabelPage2"); | ||
|
|
||
| // Get the position of the top label on Page 2 | ||
| var topLabelPage2 = App.FindElement("TopLabelPage2"); | ||
| var rectPage2 = topLabelPage2.GetRect(); | ||
|
|
||
| // The top labels should be at the same Y position on both pages | ||
| // If SafeAreaEdges is broken on the second page, the label will be clipped under the toolbar | ||
| // and positioned differently than on the first page | ||
| Assert.That(rectPage2.Y, Is.EqualTo(rectPage1.Y).Within(5), | ||
| $"Top label on Page 2 (Y={rectPage2.Y}) should be at the same position as Page 1 (Y={rectPage1.Y})"); | ||
|
|
||
| // Both labels should be below the toolbar (not at Y=0 or negative) | ||
| Assert.That(rectPage1.Y, Is.GreaterThan(0), | ||
| $"Top label on Page 1 should be below the toolbar (Y={rectPage1.Y})"); | ||
| Assert.That(rectPage2.Y, Is.GreaterThan(0), | ||
| $"Top label on Page 2 should be below the toolbar (Y={rectPage2.Y})"); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 revert changes to this file
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.
The changes to this file were already reverted in commit fe1649f.