ShippedSmall

Add .sidebar-end modifier so sidebar layouts can put the narrow column on the right, with contract entries

Proposed by Jonathan Miller 1 month agoFunding opened 1 month agoFunded 1 month agoShipped 1 month ago
Acceptance · round 1
Shipped
CINo checks
Automated reviewPass with concerns

The CSS is small and correct: `.sidebar-end` uses higher-specificity selectors that reset every property the base sidebar rules set, handles the single-child case, and needs no order or reverse. The contract files, fixture, static checks, a unit test and a Playwright browser check are all updated consistently, with documentation added. The main reservation is that no CI ran, so passing tests are claimed rather than shown; a possibly stale token-count estimate is also worth a quick look.

Acceptance criteria · 7 of 8 met
  • YES.sidebar-end with each of .sidebar/.sidebar-sm/.sidebar-lg puts the last child at --sidebar-width and the first child filling the remaining space`src/layout.css` adds `.sidebar-end:is(.sidebar, .sidebar-sm, .sidebar-lg) > :first-child` (basis 0, grow 999) and `> :last-child:not(:first-child)` (basis var(--sidebar-width), grow 1), and `check-layout-browser.mjs` checks the side width, `sideAtEnd` and `mainFills` at 1280px for all three variants.
  • YESWhen the first child cannot keep 50%, the layout wraps to one column with the main child on topThe first-child rule sets `min-inline-size: 50%` and DOM order is unchanged, and the browser check asserts `stacked`, `mainFirst` and `fullWidth` in the 375px frame.
  • YESAn inline --sidebar-width override changes the narrow column's widthThe fixture has a `sidebar-end-wide` instance with `--sidebar-width: 20rem`, and the browser check asserts a 20rem content-box width.
  • YESExisting .sidebar* behaviour without .sidebar-end is unchangedThe base sidebar rules are untouched, the new selectors require the `.sidebar-end` class, and the existing browser checks are unchanged.
  • YESWith one child, .sidebar-end does not narrow that childAn only child matches only the first-child (grow 999) rule because the last-child rule is guarded with `:not(:first-child)`, and the browser check asserts `onlyFull`.
  • YESThe CSS uses no order, row-reverse or column-reverseThe new rules contain only flex-basis, flex-grow and min-inline-size, and a test confirms the existing order-changing check catches an injected `row-reverse`.
  • YES.sidebar-end appears in synthcss.llm.md (Layout Vocabulary, Intent Mapping, Valid Example) and in synthcss.ai.jsonBoth files gain the vocabulary entry, the intent-map row and the dashboard valid example matching the proposal markup.
  • UNCLEARContract sync verification and the existing test/lint suite passThe builder reports `npm test` (68 node tests) and `verify-ai-contract` passing, but no CI ran to confirm this.
Concerns
  • No CI ran on this commit. The claims that `npm test`, `verify-ai-contract` and the Playwright browser check pass rest only on the builder's report.
  • The builder summary is truncated mid-sentence about the token estimate. The showcase apparently still shows ≈2,830 tokens while `synthcss.llm.md` is now about 3,030 tokens, so a displayed estimate may be stale; worth confirming whether the README, `docs/ai-contract.md` or the showcase need updating.
  • The static check in `check-layout.mjs` matches the `.sidebar-end` selectors by exact string. Reformatting the selector (for example, whitespace inside `:is()`) would fail the check even if the CSS is still correct. This is minor and only causes false failures.
  • The documentation changes go beyond the spec (`docs/layout.md`, `docs/tokens.md`, `docs/ai-contract.md`, README). They are accurate and on-topic, so this is not a real problem, just extra surface to review.
  • The new `synthcss.llm.md` Intent Mapping row writes `(or -sm/-lg)` without code formatting, while the spec shows `-sm`/`-lg` in code. This is cosmetic.
CI details
No CI checks ran on this commit.

BackersAccepted
1 accept · 0 rebuild · 0 not voted · quorum 1 of 1
MaintainerMerge

Accepted by the backers and merged by the maintainer.

Ballots · 1
AcceptJonathan Miller

Automated review cost $0.11, counted as builder cost.

Add .sidebar-end modifier: sidebar layout with the narrow column on the right

Motivation

.sidebar, .sidebar-sm and .sidebar-lg always make the first child the narrow column. Dashboards often need a wide main column with a narrow column on the right.

The contract currently offers no compliant way to build this:

  • Visual reordering (order, *-reverse) is banned.
  • Custom flex or grid CSS is banned (Rule 2).
  • .grid only produces equal columns.

In benchmark runs, models either fell back to an equal-width .grid or wrote non-compliant CSS.

Scope

  1. CSS: add a .sidebar-end modifier in the layout primitives stylesheet, next to the existing sidebar rules. It combines with .sidebar, .sidebar-sm and .sidebar-lg.
    • It makes the last child the narrow column, using flex-basis: var(--sidebar-width) and flex-grow: 1.
    • It makes the first child the growing main column, using flex-basis: 0, flex-grow: 999 and min-inline-size: 50%.
    • DOM order stays the visual order. No order and no *-reverse are used.
    • The proposer's reference CSS is the starting point. The agent must check that its selectors beat the existing sidebar rules on specificity, and must reset any properties the base rules set on the first and last child.
    • Edge case: with a single child, .sidebar-end must not shrink that child. The proposer's reference uses :last-child:not(:first-child) for this.
  2. Width: per-instance width uses the existing --sidebar-width token override, e.g. style="--sidebar-width: 20rem". No new tokens are added.
  3. synthcss.llm.md:
    • Add .sidebar-end to the Layout Vocabulary.
    • Add an Intent Mapping row: "Main content with a narrow side column on the right → .sidebar (or -sm/-lg) + .sidebar-end".
    • Add a Valid Example matching the proposal's markup.
  4. synthcss.ai.json: add the equivalent entries so that the existing contract sync verification passes.
  5. Tests: if the repo has CSS/contract tests, extend them to cover the new class.

Acceptance criteria

  • .sidebar-end combined with each of .sidebar, .sidebar-sm and .sidebar-lg produces this layout when there is enough room:
    • the last child at --sidebar-width;
    • the first child filling the remaining inline space.
  • When the first child cannot keep at least 50% of the container's inline size, the layout wraps to one column with the main (first) child on top.
  • Overriding --sidebar-width inline on the container changes the width of the narrow (last) column.
  • Existing .sidebar* behaviour without .sidebar-end is unchanged.
  • With one child, .sidebar-end does not narrow that child.
  • The CSS uses no order, row-reverse or column-reverse.
  • .sidebar-end appears in synthcss.llm.md (Layout Vocabulary, Intent Mapping, Valid Example) and in synthcss.ai.json.
  • The contract sync verification passes, and so does the existing test/lint suite.

Assumptions

  • No showcase update, unless the maintainer asks for one.
  • No version bump or changelog edit, unless the repo convention requires it.

Out of scope

  • New width tokens or size variants.
  • Changes to .grid or .split.
  • Container-query or breakpoint-based behaviour.

No comments yet.