[csswg-drafts] [css-position][css-anchor-position] Splitting Scrollable Containing Blocks (#12607)

fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-position][css-anchor-position] Splitting Scrollable Containing Blocks ==
When reviewing some incorrect testcases about the interaction of anchor positioning and scroll containers, and also the considering https://github.com/w3c/csswg-drafts/issues/10861, Tab and I concluded that there are multiple behaviors that are needed when attaching an abspos to a scrollable containing block, and we should introduce a switch. (Ian and Tab also came to this conclusion in a different discussion.)

The three possible behaviors for a scrollable containing block are:
* attach to the scrollport, do not scroll with the content ("outside" the scroller)
* attach to the "initial containing block" (coinciding with the scrollport at the initial scroll position), scroll with the content ("inside" the scroller)
* attach to the "scrollable containing block" (roughly the scrollable overflow area), scroll with the content

Our proposal is to split positioning into three controls:
* `position-type: absolute | static | relative | sticky`
* `position-attachment: auto | local | fixed | scroll`
* `position-container: nearest | farthest | <custom-ident>`

The `position-container` property was introduced in https://github.com/w3c/csswg-drafts/issues/9868

The `position-attachment` values are as follows:
* `local` - the "initial containing block" of the scroller, the ICB at the root
* `fixed` - the fixed scrollport itself, the viewport at the root.
* `scroll` - the scrollable overflow area, per https://github.com/w3c/csswg-drafts/issues/10861
* `auto` - `scroll` if using anchor positioning or `local` otherwise (for compat)

`position` would resolve as follows:
* `static` -> `position-type: static`
* `sticky` -> `position-type: sticky`
* `relative` -> `position-type: relative`
* `absolute` -> `position-type: absolute; position-container: nearest; position-attachment: auto`
* `fixed` -> `position-type: absolute; position-container: farthest; position-attachment: fixed`

For compat reasons, `position-container: farthest; position-attachment: fixed` may need to convert to `local` attachment if intercepted by a CB before the root (but it would be nice if we could not do this).

Doing this nicely will require shorthandifying `position`, though, so that's a topic we really do need to figure out. Working around this will be... awful.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12607 using your GitHub account


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

Received on Thursday, 14 August 2025 19:02:33 UTC