Skip to content

[Bug]: Snackbar appears in the wrong position when the keyboard is visible #1864

@henni99

Description

@henni99

Is there an existing issue for this?

  • I have searched the existing issues

Is there a StackOverflow question about this issue?

  • I have searched StackOverflow

What happened?

Problem

When the network is disconnected, a Snackbar appears correctly above the BottomNavigation.
However, when a search is attempted and the keyboard is shown, the Snackbar also moves upward — but it moves up too far.
It looks as if excessive keyboard padding is being applied to the Snackbar, causing it to appear much higher than expected.

The problem arises because both the system and Compose apply IME insets independently:

  • System: Uses InsetsListener to apply IME insets
  • Compose: Applies the same insets again via WindowInsets.ime

As a result, excessive padding appears above the IME — causing UI elements like Snackbars to shift too far upwards. In short, the same WindowInsets are applied twice, resulting in duplicated padding.

before.webm

Solution

I implemented a custom modifier that adjusts the composable’s padding based on the bottom of the window. As shown in the video below, it works correctly.

after.webm

If you find this issue reasonable, I would appreciate it if you could assign me to it.

Relevant logcat output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions