E476 [css-grid-2] Resolving indefinite grid spans in nested subgrids · Issue #6905 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-grid-2] Resolving indefinite grid spans in nested subgrids #6905

@mattwoodrow

Description

@mattwoodrow

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0