Skip to content

[Bug]: Android Keyboard reserves too much space on rapid re-focus after background-tap dismiss (keyboards with suggestion strip), causing double layout jump #8575

Description

@kosserin

Capacitor Version

Latest Dependencies:

@capacitor/cli: 8.5.0
@capacitor/core: 8.5.0
@capacitor/android: 8.5.0
@capacitor/ios: 8.5.0

Installed Dependencies:

@capacitor/cli: 8.5.0
@capacitor/android: 8.5.0
@capacitor/core: 8.5.0
@capacitor/ios: 8.5.0

Other API Details

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

When the keyboard is dismissed by tapping the background (input blur) and the same (or another) input is re-focused quickly (within ~1 second), the keyboard initially reserves more vertical space than it actually needs. A few milliseconds later the reserved space corrects itself to the true keyboard height, producing a visible double jump of the webview/layout.

The issue is timing-dependent and only reproducible with a specific dismiss method:

✅ Happens: dismiss via background tap (input blur) → quickly re-focus input
❌ Never happens: dismiss via native back button → re-focus input (any speed)
❌ Never happens: background tap dismiss → wait 1–2 seconds → re-focus input

The issue also appears to depend on the keyboard app — specifically on whether it renders a suggestion strip above the keys:

✅ Reproducible on Gboard (has suggestion strip)
✅ Reproducible on SwiftKey (has suggestion strip)
❌ Not reproducible on a keyboard without a suggestion strip — rapid re-focus resizes correctly out of the box

Expected Behavior

Re-focusing an input immediately after a blur-based dismiss should resize the layout once, to the correct keyboard height — identical to the behavior after a native-back dismiss or after waiting between taps.

Project Reproduction

https://github.com/kosserin/android-capacitor-keyboard-issue

Additional Information

Steps to Reproduce:

  • Create a page with a text input and enough empty background area to tap.
  • Tap the input → keyboard (e.g. Gboard or SwiftKey) opens normally.
  • Tap the background to blur the input → keyboard closes normally. ✅
  • Immediately (within ~1s) tap the input again.

Observe: the layout jumps up more than needed, then a few milliseconds later snaps back down to the correct keyboard height → visible double jump.

To confirm the timing dependency, repeat steps 3–4 but wait 1–2 seconds before re-focusing: the keyboard opens with a single, correct resize every time.

To confirm the dismiss-method dependency, dismiss with the native back button instead of a background tap: rapid re-focus works correctly every time.

To confirm the keyboard dependency, switch to a keyboard app without a suggestion strip and repeat the rapid re-focus sequence: the layout resizes correctly in a single step every time.

Link of reproduction: https://jumpshare.com/share/Ous2mkGIQQdDbATIVV9g

Reproduced on Android 16, edge to edge support

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions