Skip to content

Android: dragging a sheet while the keyboard is open leaves a keyboard-sized empty gap #790

Description

@pareshbbi

Problem

On Android (reproduced on 3.11.11 and still present in 3.11.12), open a sheet with a TextInput, focus it so the keyboard shows, then drag the sheet. The keyboard hides but the sheet stays at the keyboard-inflated height, leaving an empty gap at the bottom.

Cause

handleDragBegin sets detentIndexBeforeKeyboard = -1 (commits the inflated height). keyboardDidHide then calls setupSheetDetents(applyState = false), so BottomSheetBehavior never snaps back to the non-keyboard detent.

Fix

In keyboardDidHide, re-apply state when the pre-keyboard detent was already committed:

val shouldReapplyState = detentIndexBeforeKeyboard < 0
detentIndexBeforeKeyboard = -1
isKeyboardDismissProgrammatic = false
setupSheetDetents(applyState = shouldReapplyState)

Still broken on latest stable 3.11.12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions