diff --git a/src/Controls/src/Core/ContentPage/ContentPage.cs b/src/Controls/src/Core/ContentPage/ContentPage.cs index ea735114c594..b2b6bc267586 100644 --- a/src/Controls/src/Core/ContentPage/ContentPage.cs +++ b/src/Controls/src/Core/ContentPage/ContentPage.cs @@ -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; + +#endif } SafeAreaEdges ISafeAreaElement.SafeAreaEdgesDefaultValueCreator() diff --git a/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs b/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs index a7ae17748e6e..ad0e8f1e5b65 100644 --- a/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs +++ b/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs @@ -272,16 +272,16 @@ public void ContentView_GetSafeAreaRegionsForEdge_DefaultsToNoneWhenNoPropertySe [Fact] public void Page_GetSafeAreaRegionsForEdge_DefaultsToNoneForContentPage() { - var page = new ContentPage(); // ContentPage defaults to SafeAreaRegions.None on iOS (IgnoreSafeArea = true) + var page = new ContentPage(); // ContentPage defaults to SafeAreaRegions.None (edge-to-edge) - // ContentPage has special logic - defaults to SafeAreaRegions.None (edge-to-edge) on iOS + // ContentPage default is now None (edge-to-edge) for consistency across platforms var safeAreaView2 = (ISafeAreaView2)page; - // only iOS defaults to "None" for ContentPage so we are just validating that the default is container - Assert.Equal(SafeAreaRegions.Container, safeAreaView2.GetSafeAreaRegionsForEdge(0)); - Assert.Equal(SafeAreaRegions.Container, safeAreaView2.GetSafeAreaRegionsForEdge(1)); - Assert.Equal(SafeAreaRegions.Container, safeAreaView2.GetSafeAreaRegionsForEdge(2)); - Assert.Equal(SafeAreaRegions.Container, safeAreaView2.GetSafeAreaRegionsForEdge(3)); + // Default is now "None" for all edges when user hasn't set anything + Assert.Equal(SafeAreaRegions.None, safeAreaView2.GetSafeAreaRegionsForEdge(0)); + Assert.Equal(SafeAreaRegions.None, safeAreaView2.GetSafeAreaRegionsForEdge(1)); + Assert.Equal(SafeAreaRegions.None, safeAreaView2.GetSafeAreaRegionsForEdge(2)); + Assert.Equal(SafeAreaRegions.None, safeAreaView2.GetSafeAreaRegionsForEdge(3)); } // Tests based on existing iOS safe area usage patterns diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ButtonsLayoutResolveWhenParentSizeChangesOriginal.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ButtonsLayoutResolveWhenParentSizeChangesOriginal.png index 4428cf1b1e63..1c5b45610a9e 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ButtonsLayoutResolveWhenParentSizeChangesOriginal.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ButtonsLayoutResolveWhenParentSizeChangesOriginal.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CarouselViewItemShouldScaleProperly.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CarouselViewItemShouldScaleProperly.png index a1edb212f527..297fcd81dd48 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CarouselViewItemShouldScaleProperly.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CarouselViewItemShouldScaleProperly.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Stepper_ChangeFlowDirection_RTL_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Stepper_ChangeFlowDirection_RTL_VerifyVisualState.png index 4834c3caed21..651ebcf9aaf7 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Stepper_ChangeFlowDirection_RTL_VerifyVisualState.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Stepper_ChangeFlowDirection_RTL_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Border/BorderControlsPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Border/BorderControlsPage.xaml index efcfc9720788..b8e8dbe67087 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Border/BorderControlsPage.xaml +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Border/BorderControlsPage.xaml @@ -4,7 +4,8 @@ xmlns:local="clr-namespace:Maui.Controls.Sample" x:DataType="local:BorderViewModel" x:Class="Maui.Controls.Sample.BorderControlMainPage" - Title="ControlsPage"> + Title="ControlsPage" + SafeAreaEdges="Container"> diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml index 7dafb9698b9c..db461e3c4382 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/CollectionView/HeaderFooter/CollectionViewHeaderPage.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Maui.Controls.Sample" x:Class="Maui.Controls.Sample.CollectionViewHeaderPage" + SafeAreaEdges="Container" Title="CollectionViewFeature"> diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Stepper/StepperFeaturePage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Stepper/StepperFeaturePage.xaml index fc92f4df2342..d347ac7dab38 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Stepper/StepperFeaturePage.xaml +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Stepper/StepperFeaturePage.xaml @@ -3,7 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Maui.Controls.Sample" x:Class="Maui.Controls.Sample.StepperFeaturePage" - Title="StepperFeature"> + Title="StepperFeature" + SafeAreaEdges="Container"> (this, "DeleteMe", Callback); diff --git a/src/Controls/tests/TestCases.HostApp/Issues/ContextActionCellTest.cs b/src/Controls/tests/TestCases.HostApp/Issues/ContextActionCellTest.cs index e8f6ce5f61b5..52c9f3ca39f7 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/ContextActionCellTest.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/ContextActionCellTest.cs @@ -8,6 +8,7 @@ public class ContextActionCellTest : TestContentPage protected override void Init() { + this.SafeAreaEdges = new SafeAreaEdges(SafeAreaRegions.Container); dataSection = new TableSection { new TextCell{ Text = "Text Cell", ContextActions = { new MenuItem{ Text = "Save" } } }, new TextCell{ Text = "Text Cell 1" }, diff --git a/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs b/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs index 7b8335e5f1ae..16ed7f31b30c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs @@ -8,6 +8,7 @@ public class HiddenCollectionViewBind : ContentPage public HiddenCollectionViewBind() { + this.SafeAreaEdges = new SafeAreaEdges(SafeAreaRegions.Container); var cv = new CollectionView { IsVisible = false, diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue15253.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue15253.cs index 39794c7768fb..208fe6491f7a 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue15253.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue15253.cs @@ -9,6 +9,7 @@ public class Issue15253 : ContentPage ObservableCollection Items; public Issue15253() { + SafeAreaEdges = new SafeAreaEdges(SafeAreaRegions.Container); Items = new ObservableCollection(); Items.Add(new Model15253 { Name = "one", AutomationId = "15253One" }); Items.Add(new Model15253 { Name = "two", AutomationId = "15253Two" }); diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue16787.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue16787.cs index d94ad6c85a23..7125d4190e88 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue16787.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue16787.cs @@ -35,7 +35,7 @@ protected override void Init() Text = "The value below this label should be a 1. That's how many times the BindingContext has changed on the Templated element" } }; - + SafeAreaEdges = new SafeAreaEdges(SafeAreaRegions.Container); Content = cv; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue17283.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue17283.xaml index a0adb5ddcbb2..98b8d2ca4aa6 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue17283.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17283.xaml @@ -1,7 +1,8 @@  + x:Class="Maui.Controls.Sample.Issues.Issue17283" + SafeAreaEdges="Container"> + Title="Issue 17400" + SafeAreaEdges="Container"> + x:Class="Maui.Controls.Sample.Issues.Issue17884" + SafeAreaEdges="Container">