AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.16k stars 2.18k forks source link

TextBox input from SwiftKey not consistent with other applications #16392

Closed kerams closed 1 month ago

kerams commented 1 month ago

Describe the bug

Suggestions from SwiftKey in Avalonia behave differently to other applications. The first 2 chosen suggestions are not transformed into individual words (recording 1). Additionally, having typed the first letter, clicking on the text box and then selecting a suggestion does produce the expected result (recording 2).

To Reproduce

Expected behavior

what is (with a space at the end).

Avalonia version

11.2.999-cibuild0049782-alpha

OS

Android

Additional context

https://github.com/user-attachments/assets/17a4f714-d1d4-467f-b75b-2db6fc273037

https://github.com/user-attachments/assets/5cb3cd7f-96fe-466d-ad1d-c8cbd93db4df

kerams commented 1 month ago

Using suggestions with Entry in MAUI is also giving me the expected result, so it's safe to assume that the desired behavior is not the result of some post-processing in each individual application.

Gillibald commented 1 month ago

The non-Avalonia applications use native components so the results should match

kerams commented 1 month ago

Is there anything at all that can be done to address this? Alternative keyboards are in common use, so the issue is a painful one.

Gillibald commented 1 month ago

The relevant code is here: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs#L442 https://github.com/AvaloniaUI/Avalonia/blob/master/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs#L482 https://github.com/AvaloniaUI/Avalonia/blob/master/src/Android/Avalonia.Android/AndroidInputMethod.cs#L38

This is mainly an issue about Android's API requiring exclusive access to the text buffer

emmauss commented 1 month ago

Expected fix : https://github.com/AvaloniaUI/Avalonia/pull/16490

kerams commented 1 month ago

@emmauss - many thanks for getting on this so quickly.