dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

Scrolling doesn't work when focus is placed on bottom controls in ScrollView. [iOS] #14779

Open cat0363 opened 1 year ago

cat0363 commented 1 year ago

Description

To reproduce this issue, I defined the following layout and placed 100 items in the ScrollView.

<ScrollView Grid.Row="1" Orientation="Vertical" x:Name="svTest">
    <StackLayout Orientation="Vertical" x:Name="slTest">
        <BindableLayout.ItemTemplate>
            <DataTemplate>
                <Grid ColumnDefinitions="30,*" HeightRequest="44">
                    <Label Grid.Column="0" FontSize="18" Text="{Binding No}" TextColor="Black" HorizontalTextAlignment="End" VerticalOptions="Center" />
                    <Entry Grid.Column="1" FontSize="18" Text="{Binding ItemName}" TextColor="Black" />
                </Grid>
            </DataTemplate>
        </BindableLayout.ItemTemplate>
    </StackLayout>
</ScrollView>

Tap the input field at the bottom displayed in ScrollView.

The input field you tapped will be focused, but the software keyboard will cover it and you will not be able to see it.

When a control inside the ScrollView is focused, I expect the control to be v isible by scrolling so that the software keyboard doesn't cover the control.

In Xamarin.Forms the controls are scrolled so they are not obscured by the software keyboard, but in .NET MAUI the controls are obscured by the software keyboard as they are not scrolled.

[.NET MAUI]

https://user-images.githubusercontent.com/125236133/234443925-c082374d-e013-4839-a742-1142b2e23f0f.mp4

[Xamarin.Forms]

https://user-images.githubusercontent.com/125236133/234445061-eb93dfec-2ae4-4cbf-9b53-d744e7056a94.mp4

I would like the same behavior as Xamarin.Forms. iOS only does not work as expected. Works as expected on Android.

Steps to Reproduce

Below are the steps to reproduce.

  1. Tap the input field at the bottom of the display area placed in ScrollView.

The input field tapped in step 1 will be hidden by the software keyboard covering it.

When a control placed inside a ScrollView is focused, I would expect the focused control to be visible without being obscured by the software keyboard.

Link to public reproduction project repository

https://github.com/cat0363/Maui-IssueFocusScroll.git

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.4

Did you find any workaround?

None

Relevant log output

No response

ghost commented 1 year ago

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.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on iOS 16.4, not repro on Android 13.0-API33 with below Project: Maui-IssueFocusScroll.zip

lommez commented 2 months ago

I´ve the same problem in .NET MAUI Hybrid application. When a input html element is focused, the auto scrolling is not working. Is that a known bug? Or maybe i need to do something in my code?