-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix SafeArea management on iOS #28283
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Binary file added
BIN
+121 KB
...estCases.Android.Tests/snapshots/android/ScrollViewShouldRenderWithinBounds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
src/Controls/tests/TestCases.HostApp/Issues/Issue24246.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,11 @@ | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue24246" | ||
| Title="Issue24246" | ||
| xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls" | ||
| ios:Page.UseSafeArea="false"> | ||
| <VerticalStackLayout Background="Purple" IgnoreSafeArea="False" VerticalOptions="Start" IsClippedToBounds="True" > | ||
| <Entry AutomationId="entry" Background="Green"></Entry> | ||
| <Label AutomationId="label" Text="If you can't interact with the above entry field, the test has failed" LineBreakMode="CharacterWrap"></Label> | ||
| </VerticalStackLayout> | ||
| </ContentPage> | ||
11 changes: 11 additions & 0 deletions
11
src/Controls/tests/TestCases.HostApp/Issues/Issue24246.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,11 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
|
|
||
| [Issue(IssueTracker.Github, 24246, "SafeArea arrange insets are currently insetting based on an incorrect Bounds", PlatformAffected.iOS)] | ||
| public partial class Issue24246 : ContentPage | ||
| { | ||
| public Issue24246() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
src/Controls/tests/TestCases.HostApp/Issues/Issue27715.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,53 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue27715"> | ||
|
|
||
| <ContentPage.Resources> | ||
| <Style TargetType="Border" | ||
| x:Key="CardStyle"> | ||
| <Setter Property="StrokeShape" | ||
| Value="RoundRectangle 20"/> | ||
| <Setter Property="Background" | ||
| Value="#E0E0E0"/> | ||
| <Setter Property="StrokeThickness" | ||
| Value="0"/> | ||
| <Setter Property="Padding" | ||
| Value="15"/> | ||
| </Style> | ||
| </ContentPage.Resources> | ||
|
|
||
|
|
||
|
|
||
| <Grid BackgroundColor="red"> | ||
| <ScrollView Orientation="Vertical"> | ||
| <VerticalStackLayout Spacing="5" | ||
| Padding="15"> | ||
| <Border Style="{StaticResource CardStyle}"> | ||
| <Label Text="Border"/> | ||
| </Border> | ||
| <ScrollView Orientation="Horizontal" | ||
| Margin="-30,0"> | ||
| <HorizontalStackLayout Spacing="15" | ||
| Padding="30,0" | ||
| BindableLayout.ItemsSource="{Binding Projects}"> | ||
| <BindableLayout.ItemTemplate> | ||
| <DataTemplate> | ||
| <Border Style="{StaticResource CardStyle}"> | ||
| <VerticalStackLayout Spacing="15"> | ||
| <Image HorizontalOptions="Start" | ||
| Source="dotnet_bot.png" | ||
| Aspect="Center"> | ||
| </Image> | ||
| </VerticalStackLayout> | ||
| </Border> | ||
| </DataTemplate> | ||
| </BindableLayout.ItemTemplate> | ||
| </HorizontalStackLayout> | ||
| </ScrollView> | ||
| <Label Text="Tasks" | ||
| AutomationId="label"/> | ||
| </VerticalStackLayout> | ||
| </ScrollView> | ||
| </Grid> | ||
| </ContentPage> |
27 changes: 27 additions & 0 deletions
27
src/Controls/tests/TestCases.HostApp/Issues/Issue27715.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,27 @@ | ||
| using System.Collections.ObjectModel; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 27715, "ScrollView inside a Grid expands width past device screen when rotated", PlatformAffected.iOS)] | ||
| public partial class Issue27715 : ContentPage | ||
| { | ||
| public Issue27715() | ||
| { | ||
| InitializeComponent(); | ||
| BindingContext = new Issue27715_ViewModel(); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| public class Issue27715_ViewModel | ||
| { | ||
| static string[] items = new[] { "Project 1", "Project 2", "Project 3", "Project 4", "Project 5" }; | ||
|
|
||
| public ObservableCollection<string> Projects { get; set; } = new ObservableCollection<string>(items); | ||
|
|
||
| public Issue27715_ViewModel() | ||
| { | ||
| } | ||
| } | ||
|
|
||
| } |
26 changes: 26 additions & 0 deletions
26
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24246.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,26 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue24246 : _IssuesUITest | ||
| { | ||
| public Issue24246(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "SafeArea arrange insets are currently insetting based on an incorrect Bounds"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Layout)] | ||
| public void TapThenDoubleTap() | ||
| { | ||
| App.WaitForElement("entry"); | ||
| App.EnterText("entry", "Hello, World!"); | ||
|
|
||
| var result = App.WaitForElement("entry").GetText(); | ||
| Assert.That(result, Is.EqualTo("Hello, World!")); | ||
| } | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27715.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,27 @@ | ||
| #if ANDROID || IOS //Issue is only reproducible on Android and iOS platforms. | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue27715 : _IssuesUITest | ||
| { | ||
|
|
||
| public Issue27715(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "ScrollView inside a Grid expands width past device screen when rotated"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.ScrollView)] | ||
| public void ScrollViewShouldRenderWithinBounds() | ||
| { | ||
| App.WaitForElement("label"); | ||
| App.SetOrientationLandscape(); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| } | ||
| #endif |
Binary file added
BIN
+113 KB
.../tests/TestCases.iOS.Tests/snapshots/ios/ScrollViewShouldRenderWithinBounds.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
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.
Uh oh!
There was an error while loading. Please reload this page.
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 is the goal of this UITest, the entry should be visible and the user should be able to interact with it.

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.
I was curious what this looked like on main so if anyone else was wondering :)
edit: this is already here: #28264