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

Android: Typing Japanese text is extremely difficult #18013

Open
MineCake147E opened this issue Jan 21, 2025 · 2 comments
Open

Android: Typing Japanese text is extremely difficult #18013

MineCake147E opened this issue Jan 21, 2025 · 2 comments

Comments

@MineCake147E
Copy link
Contributor

MineCake147E commented Jan 21, 2025

Describe the bug

While typing テスト then あか with Gboard Japanese keyboard in a simple Avalonia apps, it somehow tries to move the cursor forcefully back to beginning at random timing.

screen-20250121-223723-edited.mp4

Such behavior makes Japanese input almost impossible.

To Reproduce

  1. Create an Avalonia project with Community Toolkit and Compiled Bindings
  2. EDIT: Upgrade TargetFramework to net9.0-* in all projects
  3. Edit the MainView.axaml as shown below
  4. Edit the MainViewModel.cs as shown below
  5. Start debugging with physical Android device with Gboard and its Japanese QWERTY keyboard installed
  6. Type irohanihoheto and look at the hiragana shown in text box

MainView.axaml

<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="clr-namespace:AvaloniaInputMethod.ViewModels"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="AvaloniaInputMethod.Views.MainView"
             x:DataType="vm:MainViewModel">
  <Design.DataContext>
    <!-- This only sets the DataContext for the previewer in an IDE,
         to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
    <vm:MainViewModel />
  </Design.DataContext>
  <DockPanel>
    <Border DockPanel.Dock="Top" Margin="2" BorderBrush="{DynamicResource TextControlBorderBrush}" BorderThickness="1" CornerRadius="2">
      <TextBlock Text="{Binding Input, Mode=OneWay}"/>
    </Border>
    <TextBox Text="{Binding Input, Mode=TwoWay}" AcceptsReturn="True" Margin="2"/>
  </DockPanel>
</UserControl>

MainViewModel.cs

using CommunityToolkit.Mvvm.ComponentModel;

namespace AvaloniaInputMethod.ViewModels;

public partial class MainViewModel : ViewModelBase
{
    [ObservableProperty]
    private string input = "";
}

Expected behavior

いろはにほへと must be shown in TextBox

Avalonia version

11.2.3

OS

Android

Additional context

Phone: Sony Xperia 1 IV (SOG06) Android 14.0 API 34
Input Method: Gboard 14.8.05.686567880-release-arm64-v8a

@kerams
Copy link
Contributor

kerams commented Jan 23, 2025

#18030 will help here too (but after messing around with keyboard switching I also managed to enter some weird state where I would not get complete hiragana syllables but always Latin consonant and hiragana vowel - it only happened once though).

qemu-system-x86_64_NhyUCWFrJZ.mp4

On master, typing gets incredibly laggy after just a couple of syllables. I think it must be some snowball effect of cyclical selection/composition changes. Nevertheless, the lag disappears with my PR change.

@emmauss
Copy link
Contributor

emmauss commented Feb 20, 2025

@MineCake147E Could you confirm if this is fixed in the latest master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants