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)

The CSS Working Group just discussed `[css-grid] grid-gap is still taking up space when an element defined in grid-template-area is not on the page.`, and agreed to the following:

* ``RESOLVED: Start defining a `grid-collapse` property``

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> oriol: the problem here is that's typical for authors when using grid to define some tracks in case some optional content is there<br>
&lt;emilio> ... if the optional content is not there, then if they use grid-gap you get extra space<br>
&lt;emilio> ... they basically want gaps to collapse together if there's no content in the track<br>
&lt;emilio> ... proposal is an `empty-tracks` property with an initial value of `normal`<br>
&lt;emilio> ... so empty tracks only collapse gaps with autofit<br>
&lt;emilio> ... then another value (`height` for `empty-cells` or `collapse` for consistency for `visibility`) that makes a track with no items in it or crossing it collapse<br>
&lt;emilio> ... there's other proposals which would make it collapse only if the sizing function is guaranteed to be zero<br>
&lt;emilio> ... or collapsing when the item spans<br>
&lt;emilio> ... but that adds a fair amount of complexity, and the simple solution already covers the vast majority of use cases<br>
&lt;emilio> ... for other variants we could consider other keywords in the future<br>
&lt;astearns> q?<br>
&lt;emilio> ... so I'd go with the simplest way<br>
&lt;emilio> q+<br>
&lt;astearns> ack emilio<br>
&lt;emilio> q+<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> fantasai: I think this value makes sense<br>
&lt;emilio> ... some of the other behaviors are probably also valuable<br>
&lt;emilio> ... so I think the name should maybe be more extensible<br>
&lt;emilio> ... my suggestion is the `grid-collapse` property (`none` / `normal` as initial, `empty-tracks` as the value oriol is proposing)<br>
&lt;emilio> astearns: `grid-track-collapse` might be better?<br>
&lt;astearns> ack emilio<br>
&lt;astearns> q+<br>
&lt;emilio> emilio: was going to bring up the name as well<br>
&lt;emilio> ... but seems like a good idea<br>
&lt;emilio> astearns: Is this always going to be grid specific? Flexbox doesn't have this implicit things, but masonry might?<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> ... just asking whether this should be layout agnostic since gaps are more layout-agnostic<br>
&lt;emilio> fantasai: conceptually it's about collapsing tracks, more than gaps<br>
&lt;emilio> ... re. grid vs. masonry they both use the grid-* track management properties<br>
&lt;emilio> ... if we're not making it grid specific we could do track-collapse, but I think grid- might make it easier to see they play together<br>
&lt;emilio> ... was going to bring up that the default value could maybe be more useful<br>
&lt;oriol> q+<br>
&lt;emilio> ... maybe if the track is completely empty and there's an intrinsic size it should collapse by default<br>
&lt;emilio> ... not sure about compat tho<br>
&lt;astearns> ack astearns<br>
&lt;emilio> astearns: yeah compat is a bit concerning here<br>
&lt;astearns> ack oriol<br>
&lt;emilio> oriol: a bit concern about changing the default for web compat<br>
&lt;emilio> ... the doing something different when the track sizing function is just intrinsic<br>
&lt;emilio> ... might be a bit weird. `auto` is intrinsic, but auto tracks stretches to fill, should it still be considered empty?<br>
&lt;emilio> ... this is related to the thing I talked about about whether the track is guaranteed to have a size of zero<br>
&lt;emilio> ... so in general more magic behavior worries me<br>
&lt;emilio> astearns: so details are going to be fuzzy, but sounds like starting to specify a `grid-track-collapse` prop might be a good idea?<br>
&lt;emilio> fantasai: if we call it `grid-collapse` we can expand it to `grid-collapse-{rows,columns}`<br>
&lt;kbabbitt> +1 fantasai<br>
&lt;emilio> ... the `track-` extra typing might be very wordy. Grid is mostly about tracks<br>
&lt;emilio> PROPOSAL: Start defining a `grid-collapse` property<br>
&lt;emilio> RESOLVED: Start defining a `grid-collapse` property<br>
&lt;fantasai> whereas grid-track-collapse-rows is very redundant<br>
</details>


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


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

Received on Wednesday, 14 May 2025 16:35:26 UTC