Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-gaps-1] Auto repeater behavior when number of gaps is less than number of values #11492

Closed
kbabbitt opened this issue Jan 13, 2025 · 3 comments

Comments

@kbabbitt
Copy link
Collaborator

Gap decoration properties allow a CSS-Grid-like repeat() notation to specify patterns of repeating items. The first parameter to repeat() can be "auto" in which case we generate as many iterations as necessary to cover all the gaps.

The repeat() notation can also be combined with fixed value specifications, for example:

column-rule-color: black repeat(auto, red blue) white;

Which would produce a black decoration in the first gap, a white decoration in the last gap, and alternating red and blue decorations in the in-between column gaps.

This leaves open the question of what to do with such a combination when the number of gaps is less than the number of values provided. Currently, the spec prioritizes values before the auto repeater, then values after the auto repeater, then uses the auto repeater to fill in any missing values. Is this the best option?

@Loirooriol
Copy link
Contributor

For grid tracks, auto repeat() is ensured to expand to at least 1 repetition. https://drafts.csswg.org/css-grid/#auto-repeat

@kbabbitt
Copy link
Collaborator Author

For grid tracks, auto repeat() is ensured to expand to at least 1 repetition. https://drafts.csswg.org/css-grid/#auto-repeat

That makes sense for grid tracks. For gap decorations it would imply that, if the gap decoration properties specify more gaps than the grid properties, we'd introduce additional empty tracks just to account for the decorations. I was aiming to keep gap decorations purely a paint-time effect and not influence layout, but maybe that's not what authors would expect?

@astearns astearns moved this to FTF agenda items in CSSWG January 2025 meeting Jan 22, 2025
@astearns astearns moved this from FTF agenda items to Friday afternoon in CSSWG January 2025 meeting Jan 28, 2025
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-gaps-1] Auto repeater behavior when number of gaps is less than number of values, and agreed to the following:

  • RESOLVED: accept the current spec text
The full IRC log of that discussion <TabAtkins> kbabbitt: gut check on a behavior
<TabAtkins> kbabbitt: one feature is a repeat() syntax for gap decos
<TabAtkins> kbabbitt: if you ahve a grid with unknown number of gaps, can use `repeat(auto, <deco list>)`
<TabAtkins> kbabbitt: can combine with decos before and after
<TabAtkins> kbabbitt: so like a data grid, black gaps between headings in first/last column, different color in body
<kbabbitt> column-rule-color: black repeat(auto, red blue) white;
<TabAtkins> kbabbitt: so with one gap, black. two gaps, black white. three gaps: black red white. four gaps+, obvious
<fantasai> fantasai: I like it
<fantasai> florian: yup
<bramus> +1
<fantasai> TabAtkins: agree, it's the right one
<fantasai> TabAtkins: aside from in Grids we don't allow partial repetition, matches
<TabAtkins> astearns: proposed resolution is that we accept the spec text
<TabAtkins> RESOLVED: accept the current spec text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Friday afternoon
Development

No branches or pull requests

3 participants