W3C home > Mailing lists > Public > www-style@w3.org > December 2015

Re: [css-grid] a few questions on auto-fill / auto-fit in the repeat() function

From: fantasai <fantasai.lists@inkedblade.net>
Date: Thu, 10 Dec 2015 16:13:37 -0500
To: www-style@w3.org
Message-ID: <5669EB01.204@inkedblade.net>
On 12/02/2015 03:32 PM, Mats Palmgren wrote:
> https://drafts.csswg.org/css-grid/#valdef-repeat-auto-fill
>
> I have a few questions on auto-fill/fit.
>
> 1. On 'auto-fit' it says "except that after grid item placement
>     any empty repetitions are dropped".  It's not clear how tracks
>     are "dropped".  For example, how many columns does this grid have?
>     <div style="display: grid;
>                 grid-template: repeat(auto-fit,100px) / 10px;
>                 width: 200px;">
>       <item style="grid-column:2"></item>
>     </div>
>
>     The text says we should "drop" empty tracks; column 1 is empty,
>     column 2 is not empty; so we drop column 1, and the answer is
>     that the grid has one column.  When I asked Daniel Holbert
>     what he thought, he said "they probably only meant for empty
>     tracks to be dropped from the end", which makes sense in
>     retrospect.  If so, then I misunderstood what the text meant
>     here so this definitely needs clarification in the spec text.
>     (FWIW, I actually implemented the drop-empty-repeat-tracks-
>     everywhere for 'auto-fit' and it's about a dozen extra lines
>     of code compared to drop-empty-repeat-tracks-from-the-end
>     version (in Gecko).  In case you've considered adding an
>     'auto-compact' repeat keyword or something ;-) .)

We did actually mean to drop all empty tracks (as you implemented),
since that seemed like the more straightforward definition.

We don't have a particularly strong opinion on this, though,
so if you thinkg dropping only tracks at the end would be
more useful to authors, we're okay with changing it.

> 2. The "Otherwise, the specified track list repeats only once."
>     at the end of 'auto-fill' is slightly ambiguous for what it
>     means for 'auto-fit'.  I'm guessing that 'auto-fit' can
>     remove that last track too if it's empty?  Perhaps you could
>     explicitly call that out under 'auto-fit', with for example:
>     "This means that 'auto-fit' can result in zero tracks if all
>     of them are empty."

Added “This could result in zero tracks, if all of them end up empty.”

> 3. I can't find a formal definition of what an "empty track" is.
>     For example, "repeat(auto-fit,[a] 100px [b])" with a grid-aligned
>     abs.pos. child placed between a and b - is that track empty?
>     I assume it is, because of the general "such elements do not take
>     up space or otherwise participate in the layout of the grid" note
>     in 10.1, but it would be good to have a formal definition of it.

Added “An empty track is one with no in-flow grid items placed into
or spanning across it.”

Let us know if these responses seem reasonable of if you'd like something else!

~fantasai and TJ
Received on Thursday, 10 December 2015 21:14:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:31 UTC