Skip to content

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

Open
@KurtCattiSchmidt

Description

@KurtCattiSchmidt

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’s specified 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 . 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 - 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] */

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions