material-components / material-components/material-components-android
[BottomSheet] PeekHeight measured incorrectly during first layout when marginTopSystemWindowInsets is set to true
Nobody has claimed this yet.
- 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, it is expected that `peekHeight` will be increased by the bottom system window inset when `paddingBottomSystemWindowInsets=true`. However, if you set `marginTopSystemWindowInsets` to `true` at the same time, then at first `peekHeight` is going to be measured incorrectly - it'll be decreased by the size of the top inset. Once you expand the sheet and collapse it again, it'll be collapsed to the correctly measured peek height.
**Expected behavior:**
Peek height should be not effected by the top system window inset, when `marginTopSystemWindowInsets=true` during every layout.
I suspect that https://github.com/material-components/material-components-android/pull/2094 might fix the issue.
**Source code:**
Here's the project which demonstrates the issue https://github.com/Lingviston/bottom-sheet-peek-height-bu/tree/master
The short recording can be found there in /demo folder.
**Android API version:** Any
**Material Library version:** 1.9.0
**Device:** Pixel 4 API 28, Pixel 2 API 31
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked bottom-sheet-peek-height-bu reproduction project and the recording in its /demo folder. Reproduce the first-layout behavior with both system-inset options enabled, then inspect the BottomSheet implementation and relevant tests to identify where the top inset affects peekHeight. Done means the initial and subsequent collapsed layouts use the same correctly inset-adjusted peek height.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100