From 328df9d243dc42be15f546b5579b58344e89feee Mon Sep 17 00:00:00 2001 From: Ryan Corbin Date: Tue, 17 Mar 2026 11:05:18 -0500 Subject: [PATCH] fix(android): restore content height when keyboard hides via insets listener The onApplyWindowInsetsListener only called possiblyResizeChildOfContent when the keyboard was showing, but never restored the content height when the keyboard was dismissed. This caused a ghost keyboard bug where returning to the app after using the keyboard in the notification pane left a black space where the keyboard was, because the content view height remained shrunk. The fix passes the current keyboard visibility state to possiblyResizeChildOfContent so it resets the height to MATCH_PARENT when the keyboard is no longer visible. This handles cases where the keyboard is dismissed without a WindowInsetsAnimation (e.g. switching back to the app from the notification shade). --- .../main/java/com/capacitorjs/plugins/keyboard/Keyboard.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/capacitorjs/plugins/keyboard/Keyboard.java b/android/src/main/java/com/capacitorjs/plugins/keyboard/Keyboard.java index e1a2ce5..5c64d51 100644 --- a/android/src/main/java/com/capacitorjs/plugins/keyboard/Keyboard.java +++ b/android/src/main/java/com/capacitorjs/plugins/keyboard/Keyboard.java @@ -60,8 +60,8 @@ public Keyboard(AppCompatActivity activity, boolean resizeOnFullScreen) { ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> { boolean showingKeyboard = ViewCompat.getRootWindowInsets(rootView).isVisible(WindowInsetsCompat.Type.ime()); - if (showingKeyboard && resizeOnFullScreen) { - possiblyResizeChildOfContent(true); + if (resizeOnFullScreen) { + possiblyResizeChildOfContent(showingKeyboard); } return insets;