Skip to content

fix(SystemBars): respect windowSoftInputMode="adjustNothing" - #8619

Open
piotrblasiak wants to merge 1 commit into
ionic-team:mainfrom
piotrblasiak:systembars-respect-adjust-nothing
Open

piotrblasiak wants to merge 1 commit into
ionic-team:mainfrom
piotrblasiak:systembars-respect-adjust-nothing

Conversation

@piotrblasiak

Copy link
Copy Markdown

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:

The mode is read from the window's softInputMode on every insets pass, so a later setSoftInputMode() is respected as well. Nothing changes for adjustResize, adjustPan or 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 = true or interactive-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

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation

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/keyboard as they do on iOS with resize: "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):

  • Skipping only the padding and passing the IME insets through, with navigator.virtualKeyboard.overlaysContent = true set in the page: the page still pans above the keyboard. The same page in Chrome on the same device does not.
  • Skipping the padding and zeroing the IME insets (the inset handling of feat(SystemBars): add keyboardInsetsHandling option to let the keyboard overlay the webview #8612, which is unchanged here): window.innerHeight and visualViewport.height stay unchanged, the page cannot be panned, and keyboardWillShow / keyboardWillHide still fire with the correct height.

The softInputMode detection that replaces the config option has not been run on a device yet, I will confirm here once it has.

Platforms Affected

  • Android
  • iOS
  • Web

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.

This branch has not been deployed

No deployments
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.

[Bug]: SystemBars resizes the WebView for the keyboard even with windowSoftInputMode="adjustNothing" (regression in 8.3.0)

1 participant