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

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.

FYI, you can try our current implementation in Firefox Nightly:
https://nightly.mozilla.org/

/Mats

Received on Wednesday, 6 January 2016 17:28:44 UTC