fix(SystemBars): avoid extra IME padding on API <= 34 in insets passthrough#8528
Open
MedOussemaNjimi wants to merge 1 commit into
Open
fix(SystemBars): avoid extra IME padding on API <= 34 in insets passthrough#8528MedOussemaNjimi wants to merge 1 commit into
MedOussemaNjimi wants to merge 1 commit into
Conversation
…hrough On API <= 34 the window is not edge-to-edge, so the system already resizes the window when the keyboard is shown. Adding imeInsets.bottom as view padding in the insets passthrough branch doubled the space, leaving a gray area the height of the keyboard above it (seen on Android 10, where the compat IME insets are non-zero after the window resize). This applies the same SDK gate that ionic-team#8439 added to the non-passthrough branch. Fixes ionic-team#8525
bb8c346 to
b5069f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8525
What
Gates the IME padding in the insets passthrough branch of
SystemBars(WebView >= 140 +viewport-fit=cover) behindBuild.VERSION.SDK_INT >= VANILLA_ICE_CREAM, the same gate that #8439 added to the non-passthrough branch.Why
Since 8.3.0 (#8384), when an input is focused on Android 10, a gray area the height of the keyboard appears above the keyboard — reproducible with a fresh
npm init @capacitor/app@latestapp (whose template usesviewport-fit=cover, so the passthrough branch is taken on devices with WebView >= 140).On API <= 34 Capacitor does not run edge-to-edge, so the system already resizes the window when the IME is shown. On API 29 the compat
WindowInsetsCompat.Type.ime()insets are still reported as the keyboard height after that resize, sov.setPadding(0, 0, 0, imeInsets.bottom)compensated for the keyboard a second time, producing the extra gray space. (On API 30–34 the dispatched IME insets are already consumed after the resize, which is why those versions were unaffected.)#8439 fixed the exact same double-compensation in the non-passthrough branch; the passthrough branch added later in #8424 reintroduced it without the SDK gate. This PR applies the same gate there.
On API 35+ (enforced edge-to-edge) the behavior is unchanged.
Testing
./gradlew compileReleaseJavaWithJavac -b capacitor/build.gradlepasses.npm init @capacitor/app@latest, add an input field, run on Android 10 — the gray space above the keyboard no longer appears, while API 35+ keyboard handling is untouched.