Open Bug 1374171 Opened 8 years ago Updated 1 month ago

position: sticky combined with height adjustment causes scrolling glitches (bouncing)

Categories

(Core :: Layout, defect, P3)

54 Branch
defect

Tracking

()

UNCONFIRMED
Tracking Status
firefox57 --- wontfix

People

(Reporter: reason.koan, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36 Steps to reproduce: Go to https://codepen.io/bluefantail/pen/zzKNpR Attempt to scroll to the bottom of the container. Actual results: The header becomes smaller, then glitches (bounces) for a couple of seconds, then the container scrolls back up and the header becomes large again. Expected results: The header becomes smaller and the scroll position stays at the bottom.
Behaviour in other browsers (from the StackOverflow question, reproduced): "In chrome, this bouncing can never be resolved, it stays in the infinite loop constantly adding / removing the stuck class. More interestingly in Safari, the scroll position is 'pushed back' to a state where it wont bug out." Also raised as a Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=734461
Component: Untriaged → Layout
Product: Firefox → Core
Priority: -- → P3
Severity: normal → S3

I have this issue too. You can see my StackOverflow question with a snippet and CodeSandbox below:

Stackoverflow question
CodeSandbox

I found the solution:

Set a wrapper around the sticky element, and handle the generated white space via transform to prevent the layout shift.

https://codesandbox.io/p/sandbox/intersection-observer-bouncing-issue-4g34hn

You need to log in before you can comment on or make changes to this bug.