Skip to content

Fixed blank space after closing keyboard - #74

Open
Sharcoux wants to merge 1 commit into
ionic-team:mainfrom
cantoo-scribe:blank-space-fix
Open

Fixed blank space after closing keyboard#74
Sharcoux wants to merge 1 commit into
ionic-team:mainfrom
cantoo-scribe:blank-space-fix

Conversation

@Sharcoux

Copy link
Copy Markdown

Description

Fixes a blank space left at the bottom of the WebView after the Android keyboard is dismissed when resizeOnFullScreen is enabled.

Changes in Keyboard.java:

  • Reset the content view height to MATCH_PARENT when the IME is hidden, instead of -1
  • Register a single OnApplyWindowInsetsListener on the content view (only when resizeOnFullScreen is true) and remove duplicate resize calls from the insets animation callback
  • Add edge-to-edge aware usable height calculation on Android 15+, accounting for system bar insets based on Capacitor’s adjustMarginsForEdgeToEdge config

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation
  • Other (CI, chores, etc.)

Rationale / Problems Fixed

When resizeOnFullScreen is enabled, the WebView is manually resized while the keyboard is open. After the keyboard is dismissed, the content view height was reset to -1, which does not reliably restore the layout on all devices — a blank gap can remain at the bottom of the screen.

Upstream #60 improved this by resetting height when the keyboard hides without animation, but -1 still leaves residual layout issues in some cases. This PR resets to MATCH_PARENT explicitly and consolidates resize handling into the window insets listener so hide/show transitions are handled consistently.

Also adds edge-to-edge adjustments for Android 15+ so usable height is computed correctly when system bar insets apply.

Tests or Reproductions

Tested on Android with resizeOnFullScreen: true:

  1. Focus an input field to open the keyboard → WebView resizes correctly
  2. Dismiss the keyboard (back button, tap outside, or programmatic hide) → WebView fills the screen with no blank gap at the bottom
  3. Repeat open/close several times → layout stays stable
  4. Tested with edge-to-edge enabled on Android 15+

Screenshots / Media

N/A — layout issue best observed interactively on device/emulator.

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants