Re: [csswg-drafts] [css-grid-3] Masonry - Intrinsic sizing of tracks & masonry-grid doesn't produce to good/desirable results. (#8206)

My two cents: I feel that the concept of track sizing function in grid is very tied to placement happening before sizing.

To me, it feels meaningless to have a `max-content` track that ends up being sized much larger than any item placed within that track. [The comparison at the beginning of the spec](https://drafts.csswg.org/css-grid-3/#background) with multi-column layout feels much more appropiate to masonry rather than grid when thinking of @fantasai latter proposal, and it pretty much ties to @bfgeek alternate proposal, where `repeat(auto-fill, auto)` will do something very similar: consider the intrinsic size of all items to determine an appropiate size for a track that will automatically repeat to fill the available space.

Providing more context on @bfgeek's last point, the final position of a grid item is relevant in case it spans something like `minmax(auto, 100px)`. In such scenario, if we ignore the max track sizing function (because we don't know where the item will end up being placed) we won't constraint its automatic minimum size and accommodating its unconstrained `min-content` size could overflow the maximum of the track(s) in which we end up placing it.

I would argue that "[The full power of grid layout is available in the grid axis](https://drafts.csswg.org/css-grid-3/#grid-template-masonry)" can be tricky to achieve with such approach if two completely different behaviors are expected depending on whether masonry is in the equation or not.

PS. I'm also concerned that considering all non-explicitly placed grid items in every posible start position will likely result in bad performance, that's a guaranteed quadratic algorithm.

-- 
GitHub Notification of comment by ethanjv
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8206#issuecomment-1718936844 using your GitHub account


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

Received on Thursday, 14 September 2023 07:47:52 UTC