Closed Bug 1612561 Opened 4 years ago Closed 9 days ago

100% height sticky child prevents container height reduction when scrolled to bottom

Categories

(Core :: Layout: Positioned, defect, P3)

72 Branch
defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

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.

Component: Untriaged → Layout: Positioned
Product: Firefox → Core
Keywords: parity-chrome

Seems to work in Nightly, mind confirming? I think this was fixed by bug 1598112.

Note, though, that the spec is quite unclear here :/

See Also: → 1598112

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.

Priority: -- → P3

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.

Severity: normal → S3

This still reproduces in recent versions.

Blocks: sticky

Fixed the "Remove" button for the testcase in comment 3.

Attachment #9123843 - Attachment is obsolete: true
Status: UNCONFIRMED → NEW
Ever confirmed: true

Bug 1748891 fixed this bug. Add a WPT testing scenario of the reporter's
testcase.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Depends on: 1748891
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/303f0de5e7a8
Add a WPT for removing a sibling of sticky positioned element. r=layout-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/45932 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 9 days ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: