[csswg-drafts] [css-grid-2] Subgrid auto repeat calculation when <line-name-list> size isn't a multiple of remaining subgrid tracks (#8493)

KurtCattiSchmidt has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid-2] Subgrid auto repeat calculation when <line-name-list> size isn't a multiple of remaining subgrid tracks ==
https://www.w3.org/TR/css-grid-2/#auto-repeat

If we have a subgrid with the following column definition:

`grid-template-columns: subgrid repeat(auto-fill, [y] [z]); `

...and a subgrid that spans 1 column, should the auto-repeat count be 0? This is how Firefox and Safari have implemented it (and how I'm working on implementing it on Chromium).

Another option would be to just insert the [y] once, and have a half repetition. The spec says "repeats enough times for the name list to match the [subgrid](https://www.w3.org/TR/css-grid-2/#subgrid)’s specified [grid span](https://www.w3.org/TR/css-grid-2/#grid-span) (falling back to 0 if the span is already fulfilled).", but I would argue that in this example, the span isn't fulfilled, so it could be clarified further.

To generalize, this situation involves any time the remaining tracks for calculating a subgrid's auto-repeat is not a multiple of the size of the numbers of lines in the auto repeater's <line-name-list>. Should the number of repetitions be maximized (and thus allow for a non-integer number of repeats), or should it be floored at the largest whole number that will fit? 

Note that the spec linked above indicates that the number of repetitions should be an integer, but only in the standalone grid section. For subgrids, this is ambiguous, but I do think that the current interoperable behavior makes sense.

There are some WPT tests reinforcing that it should be an integer value floored at 0, such as http://[wpt.live/css/css-grid/subgrid/repeat-auto-fill-008.html](http://wpt.live/css/css-grid/subgrid/repeat-auto-fill-008.html) - see sub-case `fill-0t`. An extra half repetition could be used, so instead of:

`grid-template-columns: subgrid [w] repeat(auto-fill, [y] [z]) [x]; /* [w] [y] [z] [y] [z] [x] [] */`

It could be resolved to:

`grid-template-columns: subgrid [w] repeat(auto-fill, [y] [z]) [x]; /* [w] [y] [z] [y] [z] [y] [x] */`

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8493 using your GitHub account


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

Received on Thursday, 23 February 2023 23:08:21 UTC