Re: [csswg-drafts] [css-grid] grid-gap is still taking up space when an element defined in grid-template-area is not on the page. (#5813)

I think we should try for an `auto` behavior that could be enabled by default on a website (ideally, if Web-compat allows it, as the initial value). It seems unlikely that people want empty zero-sized tracks to contribute gaps, so it would be a better default behavior to collapse the gaps on such tracks.

Suggestion is values `show | hide | auto` where `hide` collapses empty tracks regardless of their size and `auto` collapses an empty grid track (merges the gaps on either side) if:
- track is _empty_ AND
- minimum size is zero or content-based AND
- maximum size is content-based AND
- its maximum size is not `auto` OR content alignment is not stretch/normal OR there's a flexible track (i.e. this empty track can't absorb extra space)

For grid a track is _empty_ if:
- no item is placed in it or spans across it

For masonry the track is _empty_ if
- same condition as grid wrt explicitly-placed items AND
- no auto-placed tracks at all

@SebastianZ I think it makes sense to address the case you outlined with spanners; it doesn't seem unusual at all. To do that, we need to know which of the various tracks to collapse if all the spanned tracks are otherwise empty: do we prioritize keeping the first track? the largest track? the track with the most items (unless there's a tie, then what)?

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


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

Received on Tuesday, 13 August 2024 20:41:31 UTC