Repository navigation
Conversation
On API 29 the window is already resized by the system when the keyboard opens (windowSoftInputMode="adjustResize"), and WindowInsetsCompat can only approximate the ime() inset there. SystemBars additionally applied that approximated height as bottom padding, so the WebView was shrunk twice and collapsed to a few hundred pixels whenever WebView >= 140 and viewport-fit=cover were in use. After a rotation with the keyboard open the stale padding stuck until the app was restarted. Only apply the IME padding on API 30+, where ime() reports the real overlap. Verified on a Huawei MAR-LX1A (Android 10, WebView 152): window.innerHeight with the keyboard open is now 442 instead of 141 CSS px, and rotating with the keyboard open no longer leaves the WebView stuck. Behaviour on API 30+ is unchanged. Fixes ionic-team#8601 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
I tested this change on a real API 29 device, and it breaks apps that use Setup: LG G7 ThinQ, Android 10 (API 29), Android System WebView 155.
Why: Suggestion: below API 30, skip the IME padding only when the framework will actually resize, for example when the decor view's system UI visibility does not include |
|
Follow-up: on 8.6.2 without this PR, the same LG G7 (API 29, WebView 155, |
|
One more data point, from the other Setup: LG G5, Android 8.0 (API 26), Android System WebView 132. That's below
Both held on two cold starts and after backgrounding. So on this branch too, below API 30, the |
Fixes #8601
What
SystemBars.initWindowInsetsListenerapplies theime()inset as bottom padding while the keyboard is visible. On API 29 that padding is applied on top of a window the system has already resized for the keyboard (windowSoftInputMode="adjustResize"), andWindowInsetsCompat.Type.ime()is only an approximation below API 30. The WebView is therefore shrunk twice.This PR only applies the IME padding on API 30+, where
ime()reports the real overlap. Both padding sites in the listener (passthrough and non-passthrough branch) use the same guard. Behaviour on API 30+ is unchanged.Reproduction
viewport-fit=cover@capacitor/android8.4.1 and 8.5.2 both affectedwindow.innerHeightdrops from 743 to 141 CSS px instead of the expected ~443;dumpsys activity topshows the parent at full height (0,0-1080,2231) andCapacitorWebViewat0,0-1080,327.Newer devices (API 30+) are not affected because
ime()reports the correct value there, and the Google API 29 emulator image ships WebView 91 (< 140), so the passthrough branch never runs on it — a physical device with a Play Store WebView is needed to reproduce.Verification
Applied via patch-package to
@capacitor/android8.4.1 in a production app and tested on a Huawei MAR-LX1A (Android 10, WebView 152):innerHeight141, footer hiddencompileReleaseJavaWithJavac,testReleaseUnitTestand the Prettier Java check pass. The non-passthrough branch (WebView < 140) received the same guard for consistency but was not exercised on a device.🤖 Generated with Claude Code