[csswg-drafts] [css-grid-1] Abspos with an overflowing grid CB (#13930)

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

== [css-grid-1] Abspos with an overflowing grid CB ==
Consider the following:

```html
<!DOCTYPE html>
<div style="position: relative; display: grid; grid-template: 150px / 150px; width: 100px; height: 100px; border: solid 3px;">
  <div style="position: absolute; inset: 0; background: green; grid-area: ???"></div>
</div>
```

That is, a 100x100 grid container, whose *grid* is 150x150 (overflowing), and an abspos child who uses that grid container as its CB.

In <https://drafts.csswg.org/css-grid/#abspos-items>, we define how to handle this case: for each of the grid-placement properties, if the value is "auto" we use the grid container's padding edge, otherwise we use the specified grid line. We have a parenthetical saying "(the padding edge of the scrollable area, if the grid container overflows)".

This text about overflowing was added to the spec 11 years ago, but never explicitly tested, and now @bfgeek is doing so. Impls don't currently actually follow that text, but he'd like to do so, at least as much as compat allows. (Specifically, he's doing the anchor positioning "use the scrollable area as your CB sometimes" behavior, and realized our current behavior interacts really badly with that.) 

Specifically, the behavior we want to land on is:

* if *one* of the grid-placement properties is non-auto, follow the text as written, and use the padding edge of the scrollable area. That ensures that common placement idioms like `grid-area: 1 / 1`, which only actually set *two* of the placement properties, will work as intended and make the abspos position against the grid; you won't run into a situation where the start line is taken from the grid and is *further along* than the padding edge of the scrollport (which can happen in implementations *today*). (This applies even if the one non-auto value is in a different axis; once you're using the grid at all, use the grid entirely.)
* if *all* of the grid-placement properties are "auto", then just ignore the grid and do the normal abspos behavior of using the padding edge of the scrollport (or, if anchor position (or future 'position-attachment') says otherwise, the scrollable area).

In other words, follow the Grid spec if *at least one* grid-placement property is non-auto (it works better with anchor pos); otherwise ignore the Grid spec and just act as normal (Ian thinks it's very likely we're compat-constrained here).

Does this sound reasonable? It would be a small change to the spec to fix up this language.

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


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

Received on Friday, 15 May 2026 19:32:53 UTC