material-components / material-components/material-components-android

[BottomSheet] Bottom insets are cut when paddingTopSystemWindowInsets is set to false

Open
#3,375 2 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: BottomSheet
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:**

When application is in edge-to-edge mode, I need the standard `BottomSheet` with scrollable content to satisfy the following:
1. Do not reach the top system bar when fully scrolled
2. Have content shifted at the bottom by the bottom system bar height
3. Have no need for the extra scroll when content is not scrollable

To achieve that I use the following combination of the insets params:
- `app:paddingBottomSystemWindowInsets="true"` - to shift the content from the bottom
- `app:paddingTopSystemWindowInsets="false"` - to make it not reach the top system bar. Notice that I tried using the `app:marginTopSystemWindowInsets=true` instead. It works fine with the given case, but doesn't work in generic case. For instance in case of modal sheet with short content you always have to scroll the sheet up by a measure of top margin.

However, when I launch the app and scroll the content fully, the bottom padding is not fully displayed! Instead I see the padding, which is equal to the "bottom bar height" - "top bar height". Also, in layout inspector I can see that bottom padding is rendering out of the window.

See the below screenshots
- [App](https://imgur.com/xkMYsy7)
- [Layout inspector](https://imgur.com/IkoHjym)

**Expected behavior:**

Combination of the `app:paddingBottomSystemWindowInsets="true"` and `app:paddingTopSystemWindowInsets="false"` should work as per documentation, i.e. not let the sheet render under the top bar and at the same time shift content from the bottom by the size of the bottom bar.

**Source code:**

Enable edge rendering mode in activity and use the following layout:

```




```

**Android API version:** Any

**Material Library version:** 1.9.0

**Device:** Pixel 4 API 28

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with BottomSheetBehavior using the provided CoordinatorLayout, NestedScrollView, and inset attributes in edge-to-edge mode. Start by tracing BottomSheetBehavior's handling of paddingBottomSystemWindowInsets and paddingTopSystemWindowInsets, then verify scrolling with the Pixel 4 API 28 configuration. Done means the full bottom system-bar padding remains visible without reaching the top bar or requiring extra scrolling for short content.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.