Skip to content

[css-grid-1] Resolving repeat counts for percentage tracks with indefinite width + definite max-width #4480

@fantasai

Description

@fantasai

From @Loirooriol in #4043:

I think there is the remaining case of both sizing functions being indefinite, like a grid container with width: max-content; max-width: 100px; grid-template-columns: repeat(auto-fill, 50%). This falls into this case because the max size is definite, but the preferred size is intrinsic, so the percentage track size is initially treated as auto, right?

The spec currently says:

When auto-fill is given as the repetition number, if the grid container has a definite size or max size in the relevant axis, then the number of repetitions is the largest possible positive integer that does not cause the grid to overflow its grid container (treating each track as its max track sizing function if that is definite or as its minimum track sizing function otherwise, and taking gap into account); if any number of repetitions would overflow, then 1 repetition. Otherwise, if the grid container has a definite min size in the relevant axis, the number of repetitions is the smallest possible positive integer that fulfills that minimum requirement. Otherwise, the specified track list repeats only once.

The intention was to make the repetition calculation something that can be performed without resolving indefinite sizes on the grid or the tracks, but if the grid has an indefinite min size, for example, the current wording doesn't handle that case well.

Probably what should happen is we resolve percentages and calculate the repetitions against the hypothetical size of the grid, where the hypothetical size is the first definite option of { preferred size, max size, min size } and is clamped by any definite min or max size.

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