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.26k stars 1.76k forks source link

iOS hangs when choosing to Select All text on an Editor when AutoSize = TextChanges #25940

Open InquisitorJax opened 2 days ago

InquisitorJax commented 2 days ago

Description

When adding an Editor to the AutoSize property set to TextChanges... adding a bunch of text and then tapping the editor to make use of the "Select All" option from UITextView freezes the app:

Image

Steps to Reproduce

Craete the default new Maui app, and add an editor:

<Editor HorizontalOptions="Fill" BackgroundColor="Yellow" AutoSize="TextChanges"/>

When you type in a bunch of text, and the choose the "Select All" from the UITextView options, the app will freeze.

Full main page:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp2.MainPage">

        <VerticalStackLayout
            Padding="30,0"
            Spacing="25">
            <Image
                Source="dotnet_bot.png"
                HeightRequest="185"
                Aspect="AspectFit"
                SemanticProperties.Description="dot net bot in a race car number eight" />

            <Label
                Text="Hello, World!"
                Style="{StaticResource Headline}"
                SemanticProperties.HeadingLevel="Level1" />

            <Label
                Text="Welcome to &#10;.NET Multi-platform App UI"
                Style="{StaticResource SubHeadline}"
                SemanticProperties.HeadingLevel="Level2"
                SemanticProperties.Description="Welcome to dot net Multi platform App U I" />

            <Button
                x:Name="CounterBtn"
                Text="Click me" 
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Fill" />

            <Editor HorizontalOptions="Fill" BackgroundColor="Yellow" AutoSize="TextChanges"/>
        </VerticalStackLayout>

</ContentPage>

Link to public reproduction project repository

No response

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 18.1

Did you find any workaround?

Yes - see custom handler implementation in this issue

Relevant log output

Ying-6 commented 2 days ago

This issue has been verified using Visual Studio 17.13 Preview 1(9.0.10 & 9.0.0 & 8.0.100). Can repro this issue on iOS platform.

formerlymisterhenson commented 2 days ago

Maybe this can be fixed with the workaround mentioned in https://github.com/dotnet/maui/issues/17757 as this worked for me for a very similiar freezing issue (mark bigger chunks of text fast).

InquisitorJax commented 1 day ago

I can confirm that the work-around fixes the issue - thanks @formerlymisterhenson :)