[csswg-drafts] [css-grid-2] Resolving indefinite grid spans in nested subgrids (#6905)

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

== [css-grid-2] Resolving indefinite grid spans in nested subgrids ==
My understanding of the concept of indefinite/definite grid spans for subgrids is so that the explicit grid for a sub grid can be calculated without a dependency on item placement in the parent grid.

Consider this pseudo-code example:

<grid=auto / repeat(10, 10px)>
 <grid subgrid column= 1 / 4>
  <item row = 1 / 2 column= auto / auto></item>
  <grid subgrid=‘[][][][]’ row= 1 / 2 column=auto / auto>
  </grid>
 </grid>
</grid>

The innermost grid is a sub grid, with an indefinite column grid span, so we should use the <line-name-list> and compute a span of 3.

When doing placement of the innermost grid item into the middle grid, I believe we should interpret the column property as 'auto / span 3' (we may need to update 8.3.1 - Grid Placement Conflict Handling to prioritise the span from the sub grid <line-name-list> over both the -start and -end properties).

I think that'd mean we'd place the item at line 2, spanning 3 to line 5. That's outside of the explicit grid for the middle sub grid, so we'd clamp the end line back to 4.

We now have a sub grid that thinks it has 3 explicit tracks, but only spans across 2 tracks in its parent. Any computations done using the 3 value would be wrong, and need to be fixed.

I think it'd be possible to have the same situation without nested subgrids, but instead triggering the 'limiting large grids' clamping during placement of the subgrid item.

The only way I can think of to resolve this (without introducing the dependency on having completed placement in the parent grid) is to clamp the innermost grids span to the maximum number of tracks in the parent (either the global track maximum if a normal grid, or the number of explicit tracks if parent is a subgrid). We'd then need to change the placement algorithm to ensure that these items are placed far enough startward to prevent further clamp. In my example above, that'd mean the innermost grid item is placed at 1 / 4, and overlapping <item>.

Alternatively, we could have the dependency on placement in the parent grid, and then the concept of indefinite grid spans shouldn't be needed.



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


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

Received on Tuesday, 21 December 2021 23:35:22 UTC