Cycle view focus if keyboard fails to open.

This commit is contained in:
Alex Hart
2026-02-02 12:59:40 -04:00
parent 2aa0b3700f
commit 853a37920c

View File

@@ -89,7 +89,15 @@ public final class ViewUtil {
if (view.isFocused()) {
view.post(() -> {
InputMethodManager inputMethodManager = ServiceUtil.getInputMethodManager(view.getContext());
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
if (!inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)) {
/*
* Sometimes when animations are disabled, the [InputMethodManager] can end up in a bad state.
* To resolve this, we can just cycle the focus of the view.
*/
view.clearFocus();
view.requestFocus();
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
});
}
}