You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-grid-2] Subgrid auto repeat calculation when <line-name-list> size isn't a multiple of remaining subgrid tracks #8493
...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:
Yeah, the spec needs fixing, but it definitely is intended to be an integer number of whole repetitions. Partial repetitions are fragile and unlikely to be what the author wants.
My reading is actually the opposite: that we should be allowing partial repetitions in this case. That's more likely to be what the author wants than to have a handful of unnamed lines at the end, imho.
The CSS Working Group just discussed [css-grid-2] Subgrid auto repeat calculation when <line-name-list> size isn't a multiple of remaining subgrid tracks, and agreed to the following:
RESOLVED: define that subgrid repeat works exactly the same as grid repeat
The full IRC log of that discussion
<JoshT> fantasai: there was a question of what to do if the subgrid has a repeat() with multiple line names
<Kurt> q+
<TabAtkins> q+
<JoshT> ... let's say two line names but the number of lines in subgrid is odd. do you just cut the last repetition or just the names don't ger assigned for the last section
<JoshT> ... my intent when I wrote the spec was that we only do whole numbers in repetitions in the repeat functions
<JoshT> ... here the number of lines is set and we just have to give names
<JoshT> ... if we cut off at the last rep, there are some lines that don't get names
<JoshT> ... but if we clamp, they all get names
<astearns> ack Kurt
<JoshT> ... that seems more reasonable than cutting up the last repetition
<JoshT> Kurt: was going to distingush between whether subgrid span size is large enough for a single repeat
<JoshT> ... but I see that's generalised to fantasai's case for splitting the remainder
<JoshT> ... that was my question. i think it's the same problem
<JoshT> ... but my concern with changing this is: is it safe to change at this point?
<astearns> ack TabAtkins
<JoshT> ... subgrid is shipped. are we OK changing how auto-repeat changes in these scenarios?
<JoshT> TabAtkins: I do not think we should change behaviour
<JoshT> ... if you have several repeated lines, you are probably depending on them as a block
<JoshT> ... and putting things next to those lines. so if you have partial repetition, your layout will be broken
<JoshT> ... they'll be too short or ???, etc
<JoshT> ... in normal grid, we don't allow partial repetitions to prevent accidentally getting a partial bit of something the author intended to be a unit
<JoshT> ... so like here if you're just defining line names
<oriol> q+
<JoshT> ... if there was a great reason to diverge, we should be self-consistent when we can. so I think the argument here is to be consistent anyway
<astearns> ack oriol
<JoshT> oriol: I agree with TabAtkins about consistency argumeny
<JoshT> ... I had idea in issue. maybe partial keyword to provide to repeat function to opt into this behaviour
<kizu> +1 to `partial` keyword, including in regular grids as well
<JoshT> fantasai: I'm OK with it!
<JoshT> astearns: resolution for this issue is to keep the subgrid autorepeat consistent with the grid autorepeat, but make a new issue for the partial keyword in the repeat function if we find a use case for it
<JoshT> ... is there any spec change for this issue needed?
<JoshT> fantasai: seems like there should be some clarification
<JoshT> TabAtkins: this was raised on the assumption that something is missing in the spec
<JoshT> RESOLVED: define that subgrid repeat works exactly the same as grid repeat
<JoshT> Kurt: that resolves things
Activity
bfgeek commentedon Feb 23, 2023
cc/ @tabatkins @fantasai
Loirooriol commentedon Feb 24, 2023
I'd keep it consistent with the standalone axis and do not allow half repetitions.
Loirooriol commentedon Feb 24, 2023
If authors want partial repetitions, we could add something like
repeat(auto-fit partial, ...)and use it for both standalone and subgrid cases.tabatkins commentedon Feb 24, 2023
Yeah, the spec needs fixing, but it definitely is intended to be an integer number of whole repetitions. Partial repetitions are fragile and unlikely to be what the author wants.
fantasai commentedon Mar 28, 2025
My reading is actually the opposite: that we should be allowing partial repetitions in this case. That's more likely to be what the author wants than to have a handful of unnamed lines at the end, imho.
css-meeting-bot commentedon Aug 13, 2025
The CSS Working Group just discussed
[css-grid-2] Subgrid auto repeat calculation when <line-name-list> size isn't a multiple of remaining subgrid tracks, and agreed to the following:RESOLVED: define that subgrid repeat works exactly the same as grid repeatThe full IRC log of that discussion
<JoshT> fantasai: there was a question of what to do if the subgrid has a repeat() with multiple line names<Kurt> q+
<TabAtkins> q+
<JoshT> ... let's say two line names but the number of lines in subgrid is odd. do you just cut the last repetition or just the names don't ger assigned for the last section
<JoshT> ... my intent when I wrote the spec was that we only do whole numbers in repetitions in the repeat functions
<JoshT> ... here the number of lines is set and we just have to give names
<JoshT> ... if we cut off at the last rep, there are some lines that don't get names
<JoshT> ... but if we clamp, they all get names
<astearns> ack Kurt
<JoshT> ... that seems more reasonable than cutting up the last repetition
<JoshT> Kurt: was going to distingush between whether subgrid span size is large enough for a single repeat
<JoshT> ... but I see that's generalised to fantasai's case for splitting the remainder
<JoshT> ... that was my question. i think it's the same problem
<JoshT> ... but my concern with changing this is: is it safe to change at this point?
<astearns> ack TabAtkins
<JoshT> ... subgrid is shipped. are we OK changing how auto-repeat changes in these scenarios?
<JoshT> TabAtkins: I do not think we should change behaviour
<JoshT> ... if you have several repeated lines, you are probably depending on them as a block
<JoshT> ... and putting things next to those lines. so if you have partial repetition, your layout will be broken
<JoshT> ... they'll be too short or ???, etc
<JoshT> ... in normal grid, we don't allow partial repetitions to prevent accidentally getting a partial bit of something the author intended to be a unit
<JoshT> ... so like here if you're just defining line names
<oriol> q+
<JoshT> ... if there was a great reason to diverge, we should be self-consistent when we can. so I think the argument here is to be consistent anyway
<astearns> ack oriol
<JoshT> oriol: I agree with TabAtkins about consistency argumeny
<JoshT> ... I had idea in issue. maybe partial keyword to provide to repeat function to opt into this behaviour
<kizu> +1 to `partial` keyword, including in regular grids as well
<JoshT> fantasai: I'm OK with it!
<JoshT> astearns: resolution for this issue is to keep the subgrid autorepeat consistent with the grid autorepeat, but make a new issue for the partial keyword in the repeat function if we find a use case for it
<JoshT> ... is there any spec change for this issue needed?
<JoshT> fantasai: seems like there should be some clarification
<JoshT> TabAtkins: this was raised on the assumption that something is missing in the spec
<JoshT> RESOLVED: define that subgrid repeat works exactly the same as grid repeat
<JoshT> Kurt: that resolves things