Skip to content

Arrange plain playground choices in the author's columns again - #3963

Merged
max-sixty merged 2 commits into
mainfrom
playground-choice-columns-plain-row
Oct 25, 2026
Merged

max-sixty merged 2 commits into
mainfrom
playground-choice-columns-plain-row

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

#3952 made --playground-choice-columns arrange plain label choices as it does rich candidates: in 24 configuration samples, authors looked the property up in Leaf's CSS, and 13 of 78 pages ended with rules against the generated .lf-playground-choices class. #3953 then made plain label choices a wrapping row that breaks between whole labels, since equal grid cells broke "over 1% (today)" across two lines in a card with room to spare. Its merge kept the row and dropped #3952's behavior, so on main plain choices ignore the property while rich candidates honor it, and packages/playground/instructions/author.md says plain choices take no columns.

Now both hold. Plain label choices are a wrapping row by default. When the property is set on the choice control or its parent, plain and rich choices both take its value as their grid columns, through one rule in packages/playground/theme.css. A plain face starts its cell at its words' width, so a label wraps only where its column is narrower than it.

A var() fallback can't turn the plain row's flex box into a grid, so the rule sits in @container style(--playground-choice-columns), which asks the group's parent, the control, whether the property is set. The boolean style query matched in Chromium 153, Firefox 155 and WebKit 26.6; if() failed in Firefox 155, which is why the change doesn't use it. Rich candidates keep their auto-fit default when the property is unset. The rule's :scope (the control) outweighs that default, and a quoted playground still reads the property on its candidates directly. author.md now says plain choices wrap between whole labels by default and that the property arranges either kind.

A new browser test, test_plain_choices_wrap_between_whole_labels_until_the_author_sets_columns, checks both states. It fails on main, where the property leaves plain choices in one row.

Evidence (local, .tmp/cols/evidence/ in this change's worktree): a fixture with long labels in a 28rem card, leaf-dev probe --base crops.

  • main-default-row.png and fix-default-row.png match. "over 1% (today)" and "Open a ticket for the payments team" stay on one line and wrap between labels.
  • main-columns-set.png: with repeat(2, minmax(0, 1fr)) and repeat(3, minmax(0, 1fr)) set, the choices stay in a row.
  • fix-columns-set.png, and fix-columns-set-firefox.png from Firefox: the same choices sit in two and three columns. A label wraps only where it's wider than its column.
  • motion-playground (rich, with the property and its narrow-screen media query) computes the same columns and gap on both arms. leaf-dev stills for playground-choice, playground-choice-phone-dark, playground-controls, playground-controls-phone, quoted-playground and motion-controls reports 6 of 6 states unchanged.

Checks:

  • tests/browser/widgets/test_playgrounds.py, tests/browser/controls/test_rings.py and tests/browser/controls/test_theme_and_device.py with -k "choice or candidates or preset or narrow or playground": 27 passed. The playground term matched the module name, so this ran all of test_playgrounds.py.
  • pnpm run test:runtime: 550 passed.
  • pnpm run check:browser is clean. The CSS is hand-written and has no generated copy.
  • pre-commit passes.

This was written by Claude Code on behalf of max-sixty

#3952 made `--playground-choice-columns` arrange plain label choices as it does rich candidates: in 24 configuration samples, authors looked the property up in Leaf's CSS, and 13 of 78 pages ended with rules against the generated `.lf-playground-choices` class. #3953 then made plain label choices a wrapping row that breaks between whole labels, since equal grid cells broke "over 1% (today)" across two lines in a card with room to spare. Its merge kept the row and dropped #3952's behavior, so on `main` plain choices ignore the property while rich candidates honor it, and `packages/playground/instructions/author.md` says plain choices take no columns.

Now both hold. Plain label choices are a wrapping row by default. When the property is set on the choice control or its parent, plain and rich choices both take its value as their grid columns, through one rule in `packages/playground/theme.css`. A plain face starts its cell at its words' width, so a label wraps only where its column is narrower than it.

A `var()` fallback can't turn the plain row's flex box into a grid, so the rule sits in `@container style(--playground-choice-columns)`, which asks the group's parent, the control, whether the property is set. The boolean style query matched in Chromium 153, Firefox 155 and WebKit 26.6; `if()` failed in Firefox 155, which is why the change doesn't use it. Rich candidates keep their auto-fit default when the property is unset. The rule's `:scope` (the control) outweighs that default, and a quoted playground still reads the property on its candidates directly. `author.md` now says plain choices wrap between whole labels by default and that the property arranges either kind.

A new browser test, `test_plain_choices_wrap_between_whole_labels_until_the_author_sets_columns`, checks both states. It fails on `main`, where the property leaves plain choices in one row.

Evidence (local, `.tmp/cols/evidence/` in this change's worktree): a fixture with long labels in a 28rem card, `leaf-dev probe --base` crops.
- `main-default-row.png` and `fix-default-row.png` match. "over 1% (today)" and "Open a ticket for the payments team" stay on one line and wrap between labels.
- `main-columns-set.png`: with `repeat(2, minmax(0, 1fr))` and `repeat(3, minmax(0, 1fr))` set, the choices stay in a row.
- `fix-columns-set.png`, and `fix-columns-set-firefox.png` from Firefox: the same choices sit in two and three columns. A label wraps only where it's wider than its column.
- `motion-playground` (rich, with the property and its narrow-screen media query) computes the same columns and gap on both arms. `leaf-dev stills` for playground-choice, playground-choice-phone-dark, playground-controls, playground-controls-phone, quoted-playground and motion-controls reports 6 of 6 states unchanged.

Checks:
- `tests/browser/widgets/test_playgrounds.py`, `tests/browser/controls/test_rings.py` and `tests/browser/controls/test_theme_and_device.py` with `-k "choice or candidates or preset or narrow or playground"`: 27 passed. The `playground` term matched the module name, so this ran all of `test_playgrounds.py`.
- `pnpm run test:runtime`: 550 passed.
- `pnpm run check:browser` is clean. The CSS is hand-written and has no generated copy.
- pre-commit passes.

> _This was written by Claude Code on behalf of max-sixty_

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 5541c78 into main Oct 25, 2026
3 checks passed
@max-sixty
max-sixty deleted the playground-choice-columns-plain-row branch October 25, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants