W3C home > Mailing lists > Public > www-style@w3.org > January 2016

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

From: fantasai <fantasai.lists@inkedblade.net>
Date: Thu, 7 Jan 2016 19:45:38 -0500
To: Mats Palmgren <mats@mozilla.com>, www-style@w3.org
Message-ID: <568F06B2.2050805@inkedblade.net>
On 01/06/2016 12:28 PM, Mats Palmgren wrote:
> On 12/10/2015 22:13, fantasai wrote:
>> 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".
>> 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.
> We chose to implement remove-empty-tracks-only-at-the-end for 'auto-fit'
> because that seems like the better default behavior.
> For example, if the first item is placed into grid-column:5 with
> the remaining items auto-placed, like so (where . denotes an empty
> cell, X an occupied cell):
> |. . . . X X X X|
> |X X X X X      |
> widening the window such that some columns in the middle becomes
> empty:
> |. . . . X X X X X X X|
> |X X                  |
> removing all empty auto-fit columns would lead to:
> |. . X X X X X X X    |
> |X X                  |
> That layout seems surprising given the style on the first item.
> I suspect that shifting the whole first row to the left and
> leaving a gap at the end is undesirable.
> So I think the spec should say that only tracks at the end
> should be removed, for two reasons:
> 1. POLA: discontinuities like the one above are surprising
> 2. it's more consistent with what the author specified (grid-column:5)
> We can easily add a 'auto-compact' keyword (that removes all tracks)
> later if there is demand for it.

I don't have any opinion on whether to drop empty tracks in the middle,
and if people feel that's more surprising, I'd be happy to change the
spec to not do that.

However, since one of the design principles of the grid spec that we
were given was to keep it symmetrical insofar as possible, if we drop
tracks from the end we should also drop them from the start.

If the author didn't want to drop tracks, he could have chosen to use
'auto-fill' instead of 'auto-fit'. If the author wants five empty
tracks at the beginning or end of the grid, he can explicitly repeat
five tracks using repeat(5, <track-width>) and those won't be dropped.

The point of 'auto-fit' is to have the extra space at the ends,
so that that space can be distributed with the alignment properties.

Received on Friday, 8 January 2016 00:46:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:59 UTC