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

オープン
#8,575 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android
領域
mobile-dev

調査の方向性

リンクされた再現プロジェクトから始め、Android 16 上で Gboard または SwiftKey を使用して、背景タップによる dismiss と再フォーカスの高速なシーケンスを再現します。ネイティブの戻る操作による dismiss、遅延した再フォーカス、候補表示ストリップのないキーボードと比較します。高速な再フォーカスによって、正しいサイズのレイアウト更新が 1 回だけ発生し、二重ジャンプが起きなければ修正完了です。

索引モデルが issue の本文から書いたものです。

説明

triage
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

主要言語
TypeScript
スター
17.1k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/capacitor のほかの issue

ionic-team/capacitor の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。