xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] Xamarin.Forms.WebView based editors failing on Android 13 only #15708

Open IVSoftware opened 1 year ago

IVSoftware commented 1 year ago

Description

Xamarin.Forms.Webview as wrapped by commercial rich text editor controls Telerik.RadRichTextEditor and Syncfusion.SfRichTextEditor is corrupting document data on Android 13 only. The behavior seems similar to #15701 logged last week, especially with the Syncfusion sample where the behavior is adding extra paragraph tags erratically when the soft focus opens or while the document is being edited with the soft keyboard.

Steps to Reproduce [clone]

Xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:tkrtf="clr-namespace:Telerik.XamarinForms.RichTextEditor;assembly=Telerik.XamarinForms.RichTextEditor"
             x:Class="reproduce_android_13_webview_issue.MainPage">
    <Grid>
        <tkrtf:RadRichTextEditor x:Name="rteditor"/>
    </Grid>
</ContentPage>

C#

public MainPage()
{
    InitializeComponent();
    // rteditor.Source = TestHtml01; // PASS
    rteditor.Source = TestHtml02; // FAIL
}

The issue occurs when control is tapped and the soft keyboard opens. Whether it works or not depends on the html.

This source behaves correctly when the editor is tapped at the end of the text to set the cursor and start editing.

public const string TestHtml01 =
@"<html>
    <body>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sagittis ante id eros aliquet faucibus.</p>
        <p>Lore mi'ps umdol or si tame tc onse ct ETU etur adi piscinge lita liqu ams agitt is a NteIderOsew aliq ue.</p>
    </body>
</html>";

log-pass-telerik.txt


However, add just one character to the end of the html and the entire document is erased as the WebView attempts to scroll to the character position.

// In this source, a single character is added at the end of paragraph 2.
public const string TestHtml02 =
@"<html>
    <body>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sagittis ante id eros aliquet faucibus.</p>
        <p>Lore mi'ps umdol or si tame tc onse ct ETU etur adi piscinge lita liqu ams agitt is a NteIderOsew aliq uet.</p>
    </body>
</html>";

log-fail-telerik.txt Look for this bookmark: #### S H O W S O F T I N P U T


Expected Behavior

expected

Actual Behavior

actual

Basic Information

Environment

Version 17.4.4
VisualStudio.17.Release/17.4.4+33213.308
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

Visual C++ 2022   00482-90000-00000-AA319
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.4.326.54890
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.4.326.54890
Azure App Service Tools v3.0.0

C# Tools   4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

DevExpress Reporting Extension   1.4
A Visual Studio extension that invokes the Report Designer editor for report definition VSREPX files.

DevExpress Reporting Tools Extension   1.0
Extends Visual Studio with tools required for the Report Designer editor.

DevExpress.DeploymentTool   1.0
A useful tool for deploying DevExpress assemblies.

DevExpress.Win.LayoutAssistant Extension   1.0
DevExpress.Win.LayoutAssistant Visual Studio Extension Detailed Info

Extensibility Message Bus   1.4.1 (main@2ee106a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.4.19 (8c0a575)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Progress Telerik WinForms Converter   2022.2.617.1
Progress® Telerik® UI for WinForms Converter

Razor (ASP.NET Core)   17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
Provides languages services for ASP.NET Core Razor.

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   17.0.10921.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.4.0.312 (d17-4@be7e8d1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.4.0.138 (remotes/origin/d17-4@d36bba3cc9)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.4.2 (c457c97)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.1.0.1 (d17-4/13ba222)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: a96bde9
    Java.Interop: xamarin/java.interop/d17-4@fcc33ce2
    SQLite: xamarin/sqlite/3.39.3@23e1ae7
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@0be567a

Xamarin.iOS and Xamarin.Mac SDK   16.1.1.27 (933c6c2c9)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

Reproduction Link

Clone minimal reproducible example project with separate branches for Telerik.RadRichTextEditor and the Syncfusion.SfRichTextEditor on GitHub.

Workaround

Attempted multiple workarounds. None have succeeded so far.

IVSoftware commented 1 year ago

One UI update 5.1 installed on the Android 13 eval phone today. Preliminary testing indicates that the bug is gone. I want to get some flight time to make sure issues don't become apparent in actual use, but will close as resolved if nothing shows up.