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-3] Reconsidering the value space of grid-auto-flow #10902

Open
fantasai opened this issue Sep 16, 2024 · 1 comment
Open

[css-grid-3] Reconsidering the value space of grid-auto-flow #10902

fantasai opened this issue Sep 16, 2024 · 1 comment
Labels
css-grid-3 Masonry Layout

Comments

@fantasai
Copy link
Collaborator

We recently introduced reversing abilities to grid-auto-flow, and are re-using the syntax from flex-flow:

grid-auto-flow: [ row | column | row-reverse | column-reverse ] || wrap-reverse

Grid placement doesn't really distinguish between wrapping or not wrapping though; wrapping isn't really a concept in Grid. So wrap-reverse feels a little awkward.

I am wondering if it would make sense to switch to different syntax, such as a syntax that explicitly says the fill order in each axis, in priority order, like this:

grid-auto-flow: [ row | row-reverse ] || [ column | column-reverse]

where the first value says what you fill first, and the second what you fill second (defaulting to the forwards direction of the opposite axis), e.g.

grid-auto-flow: row column-reverse;

wolud fill each row start to end, then add rows stacking backwards (essentially reversing the contents of each column). More examples:

grid-auto-flow: row column; /* fill by row, stacking to fill columns */
grid-auto-flow: column row; /* fill by column, stacking to fill rows */
grid-auto-flow: column-reverse row; /* fill each column in reverse order, adding columns to fill rows */
etc.

Thoughts?

@fantasai fantasai added the css-grid-3 Masonry Layout label Sep 16, 2024
@tabatkins
Copy link
Member

Grid placement doesn't really distinguish between wrapping or not wrapping though; wrapping isn't really a concept in Grid.

I don't think I agree with this. Grid auto-flowing certainly wraps - you auto-flow into a row, then wrap to the next row when you hit the end. That's exactly the same behavior you get out of Flexbox.

In general, so long as the concepts map appropriately, I'd prefer reusing microsyntaxes rather than inventing entirely new ones. This new microsyntax doesn't add any new abilities; it just re-spells wrap-reverse as row-reverse/column-reverse, and allows you to explicitly say wrap (by specifying row/column second; this value was intentionally omitted from this property since there's no nowrap to contrast it with).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-grid-3 Masonry Layout
Projects
None yet
Development

No branches or pull requests

2 participants