Skip to content
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

iOS: UseSafeArea is ignored when root-element is a ScrollView #15897

Open
thomaskaelin opened this issue Jun 28, 2023 · 19 comments
Open

iOS: UseSafeArea is ignored when root-element is a ScrollView #15897

thomaskaelin opened this issue Jun 28, 2023 · 19 comments
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter p/2 Work that is important, but is currently not scheduled for release partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@thomaskaelin
Copy link

Description

I am having a ContentPage where the SafeArea is enabled.

<ContentPage xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
             ios:Page.UseSafeArea="False">

</ContentPage>

Using a ScrollView as a root-element, the SafeArea is ignored.
Without_Grid

Wrapping the ScrollView inside a Grid leads to the desired result (SafeArea is respected):
With_Grid

Steps to Reproduce

ScrollView as root-element (SafeArea is ignored)

<ContentPage>
    <ScrollView>
        <VerticalStackLayout>
        <!-- place enough content here to make the content extend the vertical size of the screen -->
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>

Grid as a root-element (SafeArea is respected)

<ContentPage>
    <Grid>
        <ScrollView>
            <VerticalStackLayout>
            <!-- place enough content here to make the content extend the vertical size of the screen -->
            </VerticalStackLayout>
        </ScrollView>
    </Grid>
</ContentPage>

Link to public reproduction project repository

n/a

Version with bug

7.0.86

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.4

Did you find any workaround?

Wrapping the ScrollView inside a Grid-element. Performance-wise, this is a bad solution, of course.

Relevant log output

No response

@thomaskaelin thomaskaelin added the t/bug Something isn't working label Jun 28, 2023
@thomaskaelin
Copy link
Author

I just noticed, that the same error occurs when using a CollectionView as the root-element inside a ContentPage.

@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Jun 28, 2023
@PrestigiousF
Copy link

#15809

@omghb
Copy link

omghb commented Jul 25, 2023

We see this issue in our App as well with MAUI version 7.0.92.

Because of this we cannot use the On<iOS>().SetUseSafeArea(false); setting right now.

@borrmann
Copy link
Contributor

This is because ScrollView doesnt have the property IgnoreSafeArea, which is set to default to False for Layouts like Grid. I openened an issue here #16360

@borrmann
Copy link
Contributor

see also here #12417 , here #16398 , here #12823 and also potentially this one #15460

@borrmann
Copy link
Contributor

#15163

@mikeparker104 mikeparker104 added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Sep 27, 2023
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Oct 3, 2023
@samhouts samhouts added this to the .NET 8 SR2 milestone Oct 3, 2023
@Redth
Copy link
Member

Redth commented Nov 30, 2023

Are you able to try this again with a nightly build? https://github.com/dotnet/maui/wiki/Nightly-Builds

@PureWeen
Copy link
Member

Are you able to try this again with a nightly build? https://github.com/dotnet/maui/wiki/Nightly-Builds

This issue is somewhat "Fixed" in the latest SR1 by the following PR. The UIScrollView now correctly takes https://developer.apple.com/documentation/uikit/uiscrollview/2902261-contentinsetadjustmentbehavior into account. By default UIScrollView has this property set to "Automatic" which means the UIScrollView itself will occupy the DangerZone but the content inset will be set to the area outside of the DangerZone. The problem that still existsis that you can't turn off the contentinsetadjustmentbehavior from the xplat level.

That being said, the UIScrollView in SR1 will now layout correctly based on what the contentinsetadjustmentbehavior is set to, so if you change this value to NEVER on the UIScrollView then the content will layout all the way into the DangerZone.

Check out the docs here on how to customize https://learn.microsoft.com/en-us/dotnet/maui/user-interface/handlers/customize?view=net-maui-8.0

I think we can close this issue for now as a duplicate of #16360 which covers the scenario a bit more broadly.

@PureWeen PureWeen self-assigned this Dec 15, 2023
@PureWeen PureWeen removed their assignment Jan 10, 2024
@Redth Redth modified the milestones: .NET 8 SR2, Backlog Jan 10, 2024
@ghost
Copy link

ghost commented Jan 10, 2024

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@QianaJiao QianaJiao added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jan 30, 2024
@QianaJiao
Copy link

Verified this issue with Visual Studio Enterprise 17.9.0 Preview 4. Still repro on iOS platform with steps.
This bug may duplicate with #16360

@BrundhaVelusamy
Copy link

Any update on this issue?

1 similar comment
@BrundhaVelusamy
Copy link

Any update on this issue?

@ArunachalamSyncfusion
Copy link

Any update on this issue? This is a priority for us.

@PureWeen PureWeen added p/2 Work that is important, but is currently not scheduled for release and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels Jul 2, 2024
@BrundhaVelusamy
Copy link

Please provide a high priority for this issue.

@ArunachalamSyncfusion
Copy link

Any update on this issue?

1 similar comment
@BrundhaVelusamy
Copy link

Any update on this issue?

@BrundhaVelusamy
Copy link

Any workaround for this issue? Please provide a high priority for this issue.

@activa
Copy link
Contributor

activa commented Aug 22, 2024

Any workaround for this issue? Please provide a high priority for this issue.

It's indeed sad that after more than a year this still hasn't been addressed.

There is a workaround though, but it's clunky: wrap the ScrollView in a Grid

@BrundhaVelusamy
Copy link

Any update regarding this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter p/2 Work that is important, but is currently not scheduled for release partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests