Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fantasai opened this issue Nov 1, 2019 · 2 comments

Comments

@fantasai
Copy link
Collaborator
fantasai commented Nov 1, 2019

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.

tabatkins added a commit that referenced this issue Jul 17, 2023
… is definite, you only get one repetition. (Reps never depend on intrinsic sizes.) #4480
@tabatkins
Copy link
Member

Discussing offline between @fantasai @Loirooriol and I, we decided that trying to resolve the % against sizes other than the preferred size doesn't make sense, since the %s in the final layout won't use those sizes anyway, so the resulting repetition won't be meaningful.

Instead we just caught the relevant case (both min and max track sizing functions are indefinite) and made it cause the repeat() to only give one repetition.

@tabatkins
Copy link
Member

Oh, and as far as we can tell this matches browser behavior already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants