[csswg-drafts] [css-grid-1] Static position of grid children (#7661)

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

== [css-grid-1] Static position of grid children ==
While drafting https://github.com/w3c/csswg-drafts/issues/7612#issuecomment-1230963091 I noticed that we are introducing a weird inconsistency in the Grid specification:

> The [static position](https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width) [[CSS2]](https://www.w3.org/TR/css-grid-2/#biblio-css2) of an absolutely-positioned child of a [grid container](https://www.w3.org/TR/css-grid-2/#grid-container) is determined as if it were the sole grid item in a [grid area](https://www.w3.org/TR/css-grid-2/#grid-area) whose edges coincide with the content edges of the grid container. However, if the grid container parent is also the generator of the absolutely positioned element’s [containing block](https://www.w3.org/TR/css-display-3/#containing-block), instead use the grid area determined in [§ 10.1 With a Grid Container as Containing Block](https://www.w3.org/TR/css-grid-2/#abspos-items).

In general, an `inset:auto` abspos has a static position which does not change no matter where in its ancestor chain `position: relative` is introduced. But here we are making the application of grid positioning properties to determining the static position conditional on whether it is also the abspos containing block. See [testcase](https://www.software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0A.grid%20%7B%20display%3A%20grid%3B%20grid%3A%20100px%20100px%20%2F%20100px%20100px%3B%20border%3A%20solid%3B%20width%3A%20min-content%3B%20float%3A%20left%20%7D%0A.item%20%7B%20border%3A%20solid%20orange%3B%20position%3A%20absolute%3B%20grid-row%3A%202%3B%20grid-column%3A%202%20%7D%0A%3C%2Fstyle%3E%0A%3Cdiv%20class%3Dgrid%20style%3D%22%22%3E%0A%20%20%3Cdiv%20class%3Ditem%3E%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%3Cdiv%20class%3Dgrid%20style%3D%22position%3A%20relative%22%3E%0A%20%20%3Cdiv%20class%3Ditem%3E%3C%2Fdiv%3E%0A%3C%2Fdiv%3E)

I don't know if it's Web-compatible, but I think we should not be making it conditional. It should be unconditional: either applying always to grid children’s staticpos calculations, or never applying to them. (I prefer always; it gives the author more power.)


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


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

Received on Monday, 29 August 2022 23:24:55 UTC