100% height sticky child prevents container height reduction when scrolled to bottom
Categories
(Core :: Layout: Positioned, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox127 | --- | verified |
People
(Reporter: alexander, Assigned: TYLin)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome)
Attachments
(2 files, 1 obsolete file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Steps to reproduce:
I have a sticky overlay on a scrolling container:
<div class="scroll">
<div class="sticky">I'm sticky</div>
... more items here
</div>
This sticky overlay has height 100% and negative margin on bottom same as container height (I tried different techniques here) — this means it is INSIDE CONTAINER but it acts somewhat as position fixed as it is always at the same place when you scroll and it covers whole container.
Take a look at this demo:
https://stackblitz.com/edit/firefox-position-sticky-bug?file=src%2Fapp%2Fapp.component.html
Click add a few times so scroll appears, scroll to bottom and click remove.
Actual results:
When you scroll container to the bottom and start removing items from it, meaning reducing its height, sticky element prevents it.
Expected results:
Sticky element should not keep container from size reduction. When elements at bottom are removed container should scroll up a little so it is scrolled to bottom of the new layout. Chrome works this way, you can try the same demo in Chrome.
Workaround is to have sticky height of calc(100% - 1px) so that it never touches bottom of container.
![]() |
||
Updated•5 years ago
|
![]() |
||
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Seems to work in Nightly, mind confirming? I think this was fixed by bug 1598112.
Note, though, that the spec is quite unclear here :/
![]() |
||
Comment 3•5 years ago
|
||
I can still reproduce the issue on Nightly74.0a1(20200131013147) Windows10.
And I can also reproduce this issue on Firefox27 with layout.css.sticky.enabled=true;
So, this seems to be not regression.
Updated•5 years ago
|
Still an issue in 87.0b9.
The workaround calc(100% - 1px)
works fine as a workaround for the issue. Interestingly, I cannot see that 1px
gap in Firefox whereas in Chrome it is clearly visible and needs to be filled with eg. box-shadow
.
Updated•2 years ago
|
Assignee | ||
Comment 6•11 months ago
|
||
Fixed the "Remove" button for the testcase in comment 3.
Assignee | ||
Updated•11 months ago
|
Assignee | ||
Comment 7•10 months ago
|
||
Bug 1748891 fixed this bug. Add a WPT testing scenario of the reporter's
testcase.
Updated•10 months ago
|
Comment 10•10 months ago
|
||
bugherder |
Updated•10 months ago
|
Comment 12•10 months ago
|
||
Reproduced the issue on Firefox 87.0b9 on macOS 14.5 by following the infos provided in Comment 0.
The issue is fixed on Firefox 127.0b2. Tests were performed on macOS 14.5, Windows 11 and Ubuntu 24.04.
Description
•