- From: Kurt Catti-Schmidt via GitHub <sysbot+gh@w3.org>
- Date: Thu, 23 Feb 2023 23:40:02 +0000
- To: public-css-archive@w3.org
KurtCattiSchmidt has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-grid-2] Clamp out-of-range subgrid items before or after auto placement? == https://www.w3.org/TR/css-grid-2/#subgrid-implicit The spec states: "The [subgrid](https://www.w3.org/TR/css-grid-2/#subgrid) does not have any [implicit grid tracks](https://www.w3.org/TR/css-grid-2/#implicit-grid-track) in the [subgridded](https://www.w3.org/TR/css-grid-2/#subgridded-axis) dimension(s). Hypothetical [implicit grid lines](https://www.w3.org/TR/css-grid-2/#implicit-grid-lines) are used to resolve placement as usual when the [explicit grid](https://www.w3.org/TR/css-grid-2/#explicit-grid) does not have enough lines; however each [grid item](https://www.w3.org/TR/css-grid-2/#grid-item)’s [grid area](https://www.w3.org/TR/css-grid-2/#grid-area) is [clamped](https://www.w3.org/TR/css-grid-2/#clamp-a-grid-area) to the subgrid’s explicit grid (using the same procedure as for clamping placement in an overly-large grid). For example, if a span 1 subgrid has a [grid item](https://www.w3.org/TR/css-grid-2/#grid-item) with [grid-column: 2 / span 3;](https://www.w3.org/TR/css-grid-2/#propdef-grid-column), then that item is instead forced into (and limited to) the first (only) track in the subgrid." This doesn't indicate when to perform the clamping, and this can have implications on placement if it happens before or after the auto placement algorithm. Modifying the example above slightly to demonstrate this: If a column span 1 and row span 2 subgrid has a [grid item](https://www.w3.org/TR/css-grid-2/#grid-item) with [grid-column: 2 / span 3](https://www.w3.org/TR/css-grid-2/#propdef-grid-column), then that item is instead forced into (and limited to) the first track in the subgrid. Now consider if it has a second item with [grid-column: 2 / span 3](https://www.w3.org/TR/css-grid-2/#propdef-grid-column). If clamping occurs before the auto placement algorithm, both items will be clamped to the first row of the subgrid. Then, auto placement will consider the overlap, and the second item will be placed in the second row. If clamping occurs after the auto placement algorithm, both items will be placed in hypothetical implicit lines during auto-placement and will not overlap during placement. However, once they're clamped (after auto placement), the implicit lines go beyond the subgrid span, so the first and second items will be placed in the first row of the subgrid (and will occupy the same space). The intention of auto placement seems to be to avoid items occupying the same space, so it does make sense to perform clamping before auto placement (so that out-of-range items do not overlap). However, the spec is ambiguous here. Note that Firefox and Safari's behavior is to clamp before auto placement. Chromium used to clamp after auto placement, until I changed it recently to fix a subcase of http://wpt.live/css/css-grid/subgrid/repeat-auto-fill-001.html. I also added a WPT test that hits this scenario (http://wpt.live/css/css-grid/subgrid/placement-implicit-001.html). Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8494 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 23 February 2023 23:40:04 UTC