Re: [csswg-drafts] [css-contain] `scroll-state(stuck)` CQs can easily cause flickering that is very hard to work around (#13898)

Yeah, this is definitely a per-spec issue. stickypos is just a "magical" relpos; it leaves the element's geometry where it was, then shifts the paint to stay on screen. This means that if you change the geometry (the height, here) it not only affects the paint, but also the original geometry that's still taking up space in the page, and causes the rest of the page to shift. That can cause scroll stability issues and cause the element to come unstuck, creating exactly the flickering you're seeing here.

You're right that this is a core use-case. I'm curious how we haven't heard more complaints about it! (I'm pinging internally to make sure I'm not missing some easy solution that people are already using.)

Assuming we're not missing anything, though, I think the only solution is to go in the same direction as [`contain-intrinsic-size:auto`](https://drafts.csswg.org/css-sizing-4/#last-remembered) and give an element the ability to have a "last remembered unstuck size", and use *that* size for its static geometry when it becomes stuck (while still laying out normally for the purpose of its shifted paint).

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13898#issuecomment-4425404190 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 11 May 2026 21:39:54 UTC