fix(SystemBars): respect windowSoftInputMode="adjustNothing" - #8619
Open
piotrblasiak wants to merge 1 commit into
Open
piotrblasiak wants to merge 1 commit into
piotrblasiak wants to merge 1 commit into
Conversation
Detect `adjustNothing` from the window's soft input mode and treat the keyboard as not there: no IME padding, and the IME insets handed to the WebView are set to 0. The latter is needed because WebView >= 139 shrinks its visual viewport for the IME insets it receives, which makes the page pannable above the keyboard. Unlike Chrome, WebView ignores `VirtualKeyboard.overlaysContent` and `interactive-widget=overlays-content`, so there is no web-side opt-out.
Closed
8 tasks
This branch has not been deployed
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.
Description
Supersedes #8612 (I deleted the fork that PR was opened from, so it can no longer be updated). Reworked after the discussion there: no new config option, the behavior is keyed off the manifest instead.
When the activity declares
android:windowSoftInputMode="adjustNothing", SystemBars now treats the keyboard as not there:0(not consumed, see https://issues.chromium.org/issues/461332423)The mode is read from the window's
softInputModeon every insets pass, so a latersetSoftInputMode()is respected as well. Nothing changes foradjustResize,adjustPanor an unset mode.Why the IME insets are zeroed and not passed through
WebView >= 139 shrinks its visual viewport for the IME insets it receives (docs), which makes the whole page pannable above the keyboard. In Chrome a page can opt out of that with
navigator.virtualKeyboard.overlaysContent = trueorinteractive-widget=overlays-content, but WebView ignores both: Chrome implements the opt-out in its own embedder code (ApplicationViewportInsetTracker), while the WebView path (AwDisplayCutoutController/AwViewAndroidDelegate.getViewportInsetBottom()) applies the inset unconditionally and never looks at the keyboard mode. So the only opt-out in a WebView is the native one from the Android guide: not handing it the IME insets.The keyboard height stays available to the app through
@capacitor/keyboard, which reads the root window insets.Change Type
Rationale / Problems Fixed
closes #8611
Since #8384 (8.3.0) the webview is always resized for the keyboard, even when the activity declares
android:windowSoftInputMode="adjustNothing". Apps that keep content clear of the keyboard themselves, using the height from@capacitor/keyboardas they do on iOS withresize: "none", then account for the keyboard twice.Tests or Reproductions
Reproduction: see #8611.
On a Zebra TC58 (Android 15, Android System WebView 151.0.7922.199):
navigator.virtualKeyboard.overlaysContent = trueset in the page: the page still pans above the keyboard. The same page in Chrome on the same device does not.window.innerHeightandvisualViewport.heightstay unchanged, the page cannot be panned, andkeyboardWillShow/keyboardWillHidestill fire with the correct height.The
softInputModedetection that replaces the config option has not been run on a device yet, I will confirm here once it has.Platforms Affected