-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[NET10.0] Change ContentPage SafeAreaEdges default to None for consistent edge-to-edge behavior #31926
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
[NET10.0] Change ContentPage SafeAreaEdges default to None for consistent edge-to-edge behavior #31926
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
58ca282
Initial plan
Copilot 3153161
Change SafeAreaEdges defaults to None for consistent edge-to-edge beh…
Copilot 96e03d0
Add test for platform-specific UseSafeArea API and fix Layout default
Copilot 9051045
Simplify changes per feedback - only change Android default to None
Copilot 9d50ff3
Remove Layout and ScrollView changes per feedback - keep only Content…
Copilot 767c4ec
Adjust safe area insets calculation to account for view margins, ensu…
PureWeen 89e80a9
Refactor SafeAreaExtensions to improve margin handling and simplify v…
PureWeen e43e53e
- fix tests
PureWeen 83e3636
- additional fixes
PureWeen b3f2ecf
- set default contentpage to container for android consistency
PureWeen 50cadec
- fix
PureWeen 134fab3
- fix iOS screen shot offset for consistency
PureWeen 20b2f70
- set to container
PureWeen 608509f
- updates tests and screen shots for consistency
PureWeen fbcbed5
- fix screenshots
PureWeen 20167dc
- fix images
PureWeen 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,7 +181,7 @@ SafeAreaRegions ISafeAreaView2.GetSafeAreaRegionsForEdge(int edge) | |
| } | ||
|
|
||
|
|
||
| #if IOS || MACCATALYST | ||
| #if IOS || MACCATALYST | ||
|
|
||
| // Developer hasn't set SafeAreaEdges, fall back to legacy IgnoreSafeArea behavior | ||
| var ignoreSafeArea = ((ISafeAreaView)this).IgnoreSafeArea; | ||
|
|
@@ -194,12 +194,12 @@ SafeAreaRegions ISafeAreaView2.GetSafeAreaRegionsForEdge(int edge) | |
| return SafeAreaRegions.Container; // If legacy says "don't ignore", return Container | ||
| } | ||
|
|
||
| #else | ||
|
|
||
| // By default on android it was never edge to edge so we set this to container by default | ||
| return SafeAreaRegions.Container; | ||
| #else | ||
|
|
||
| #endif | ||
| // Default to None (edge-to-edge) for consistent behavior across all platforms | ||
| return SafeAreaRegions.None; | ||
|
Comment on lines
+199
to
+200
|
||
|
|
||
| #endif | ||
| } | ||
|
|
||
| SafeAreaEdges ISafeAreaElement.SafeAreaEdgesDefaultValueCreator() | ||
|
|
||
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
Binary file modified
BIN
+35 Bytes
(100%)
...d.Tests/snapshots/android/ButtonsLayoutResolveWhenParentSizeChangesOriginal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-799 Bytes
(87%)
...stCases.Android.Tests/snapshots/android/CarouselViewItemShouldScaleProperly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11 Bytes
(100%)
...d.Tests/snapshots/android/Stepper_ChangeFlowDirection_RTL_VerifyVisualState.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
1 change: 1 addition & 0 deletions
1
src/Controls/tests/TestCases.HostApp/FeatureMatrix/CarouselView/CarouselViewControlPage.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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
43 changes: 23 additions & 20 deletions
43
src/Controls/tests/TestCases.HostApp/Issues/Issue20439.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 |
|---|---|---|
| @@ -1,25 +1,28 @@ | ||
| <?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" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue20439" | ||
| xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"> | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue20439" | ||
| xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"> | ||
| <ShellContent | ||
| Title="Home"> | ||
| <ContentPage> | ||
| <StackLayout VerticalOptions="Center"> | ||
| <Entry AutomationId="entry" Text="Tap here"/> | ||
| <Button AutomationId="button" Text="Open the input page" Clicked="Button_Clicked"/> | ||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| Title="Home"> | ||
| <ContentPage SafeAreaEdges="Container"> | ||
| <StackLayout VerticalOptions="Center"> | ||
| <Entry AutomationId="entry" | ||
| Text="Tap here"/> | ||
| <Button AutomationId="button" | ||
| Text="Open the input page" | ||
| Clicked="Button_Clicked"/> | ||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
|
|
||
| <ShellContent | ||
| Title="Text input page"> | ||
| <ContentPage> | ||
| <Editor VerticalOptions="Center" | ||
| AutomationId="editor" | ||
| HeightRequest="100" | ||
| Text="Potential auto correcting words: -- :-) ... omw \n" /> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| <ShellContent | ||
| Title="Text input page"> | ||
| <ContentPage SafeAreaEdges="Container"> | ||
| <Editor VerticalOptions="Center" | ||
| AutomationId="editor" | ||
| HeightRequest="100" | ||
| Text="Potential auto correcting words: -- :-) ... omw \n"/> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| </Shell> |
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
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
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
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.
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 I think this is the only change that we need in this file.
we just need to change the default to None for platforms other than ios/catalyst
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 ContentPage.cs with the minimal change - only changed the Android default from
ContainertoNonein the#elseblock. The iOS/Mac Catalyst behavior with legacyIgnoreSafeAreais preserved. (commit 1f8e702)