From 3a16c45e8c19f67e263b93b8c136e46b59be54e7 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Thu, 19 Jun 2025 17:41:05 +0000 Subject: [PATCH] Android - Reset android input method focus and connection state when text input focus is removed (#19083) * reset android input method focus and connection state when text input focus is removed * addresses comment --- .../Avalonia.Android/Platform/Input/AndroidInputMethod.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Android/Avalonia.Android/Platform/Input/AndroidInputMethod.cs b/src/Android/Avalonia.Android/Platform/Input/AndroidInputMethod.cs index 5ac3592c4e..1223fb9ece 100644 --- a/src/Android/Avalonia.Android/Platform/Input/AndroidInputMethod.cs +++ b/src/Android/Avalonia.Android/Platform/Input/AndroidInputMethod.cs @@ -89,6 +89,9 @@ namespace Avalonia.Android.Platform.Input } else { + _host.ClearFocus(); + _imm.RestartInput(View); + _inputConnection = null; _imm.HideSoftInputFromWindow(_host.WindowToken, HideSoftInputFlags.ImplicitOnly); } } @@ -149,7 +152,9 @@ namespace Avalonia.Android.Platform.Input _host.InitEditorInfo((topLevel, outAttrs) => { if (_client == null) + { return null!; + } _inputConnection = new AvaloniaInputConnection(topLevel, this);