Skip to content

fix(layout): reserve only the part of the navigation bar the keyboard really overlaps - #828

Merged
LeanBitLab merged 1 commit into
mainfrom
fix/nav-bar-double-padding
Nov 15, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
fix/nav-bar-double-padding

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

What

A user on a Samsung Note 10 (Android 12) reports a too large gap below the keys, in every app, on 4.3.2 and 4.3.3 (also beta3). The bottom padding scale is already 0 for them and does not change it, so the gap does not come from the keyboard's own padding. They also say that after restarting the keyboard it is right once, then wrong again.

Cause (not reproduced, this is from the code and the report)

InputView caches the navigation bar inset and adds it as bottom padding, and the keyboard views also fit system windows. On such a device the IME window already leaves room for the navigation bar, so the inset is added a second time. A new input view looks right the first time because the inset has not arrived yet.

Change

  • The bottom padding is the overlap between the laid out view and the navigation bar (navBarOverlap), never more than the reported inset. If the window already leaves room, nothing is reserved.
  • The children get that value as their bottom inset, so the framework does not apply the full inset on top of it.
  • A layout listener corrects the padding once the position is known.
  • Unit tests for the overlap calculation.

Testing

  • assembleStandardDebug, compileOfflineRunTestsKotlin and NavBarOverlapTest.
  • Checked on an Android 17 device (keyboard over the navigation bar): no change.
  • Not verified on a Samsung/Android 12 device. The reporter should check it in the next beta.

… really overlaps

Some devices (reported on a Samsung Note 10, Android 12) report the navigation bar inset
although the IME window already leaves room for it. The inset was cached and added as
bottom padding on top of that room, so the gap below the keys was too large. The first
show of a new input view looked right, because the inset had not arrived yet, and later
shows were wrong.

The padding is now the overlap between the laid out view and the navigation bar, never
more than the reported inset, and that value is also what the children get as their
bottom inset, so the framework does not add the full inset again.
@LeanBitLab
LeanBitLab merged commit 777c009 into main Nov 15, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix/nav-bar-double-padding branch November 15, 2026 09:58
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.

1 participant