- From: Robert Flack via GitHub <noreply@w3.org>
- Date: Wed, 05 Nov 2025 15:04:36 +0000
- To: public-css-archive@w3.org
I propose that we change `position: sticky` to track both of the nearest scrolling containers per axis that "scroll" the content in that axis, i.e. not whether they have overflow in the axis, but whether the `overflow` value for that axis is `hidden | auto | scroll`, which in spec language may mean saying something like a box can be a horizontal scrolling container but not a vertical scrolling container.
This would solve the issue for tables which need to scroll in the other direction - see https://github.com/w3c/csswg-drafts/issues/865#issuecomment-350585274. Given the resolution we have taken for #12289 we can make this work by skipping over clip containers for that axis. E.g. if you set `.table-wrapper { overflow-x: auto; overflow-y: clip; }` then the element which is sticky position to the top (or bottom) could find the nearest ancestor **vertical** scrolling container making this use case work nicely.
This doesn't require any major spec changes, and should be relatively compatible as allowing `overflow: hidden | scroll | auto` and `overflow: clip` in the other axis is a new thing that has not yet been supported.
The issue in the OP (test case https://jsfiddle.net/utasir/rmmkxq62/11/ ) was taking advantage of the fact that overflow: hidden also establishes a new block formatting context, where overflow: clip [does not](https://www.w3.org/TR/css-overflow-3/#valdef-overflow-clip). There are other ways to accomplish the same and solve the original issue using overflow: clip which is a much better practice for content which is not supposed to be scrollable. For example, I forked the demo and was able to get the correct layout using `contain: layout` to ensure that all of the content in the article is in a new context: https://jsfiddle.net/zwd3fer2/4/
--
GitHub Notification of comment by flackr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/865#issuecomment-3491741133 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 5 November 2025 15:04:37 UTC