Skip to content

Commit fd2655a

Browse files
committed
Equalize grid-template specificity across the rail tiers
The 560px tier selects .art-cols:not(.no-side-nav) at (0,2,0), so the 860px tier's bare .art-cols template at (0,1,0) could never win and a set page on a wide pane kept the 2-column template — wrapping the TOC to the next grid row, bottom-left. The wide template now carries the same :not() guard, the 860 block's duplicate of the 800px no-side-nav rules is gone, and a test pins every template rule to equal specificity so a future tier can't silently lose the cascade again.
1 parent ee50195 commit fd2655a

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

apps/sim/lib/workspace-files/artifact-stylesheet.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,26 @@ describe('docs shell', () => {
120120
})
121121

122122
describe('docs fidelity', () => {
123+
it('keeps every grid template at equal specificity so wider tiers win', () => {
124+
// The 560px tier selects .art-cols:not(.no-side-nav) (0,2,0); a wider
125+
// tier written as bare .art-cols (0,1,0) loses despite its media query,
126+
// leaving the 2-column template active and wrapping the TOC to the next
127+
// grid row. Every template rule must carry the same specificity.
128+
const templates = SIM_ARTIFACT_STYLESHEET.split('\n').filter((line) =>
129+
line.includes('grid-template-columns:')
130+
)
131+
expect(templates.length).toBeGreaterThanOrEqual(4)
132+
for (const line of templates) {
133+
const selector = (line.trim().split('{')[0] ?? '').trim()
134+
if (!selector.startsWith('.art-cols')) continue
135+
if (selector === '.art-cols') {
136+
expect(line).toContain('grid-template-columns: 1fr')
137+
} else {
138+
expect(selector).toMatch(/^\.art-cols(:not\(\.no-side-nav\)|\.no-side-nav)$/)
139+
}
140+
}
141+
})
142+
123143
// The docs table treatment: header rule on --border, row rules on
124144
// --surface-active, no outer chrome.
125145
it('styles tables as the docs divider tables', () => {

apps/sim/lib/workspace-files/artifact-stylesheet.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,9 @@ figcaption { font-size: 0.875em; line-height: 1.4285714; color: var(--text-prima
516516
in the container, with equal flexible gutters either side. The rails
517517
live inside the gutters (sidebar hugging the left edge, TOC the right),
518518
so their unequal content widths can never skew the middle column. */
519-
.art-cols { grid-template-columns: minmax(min-content, 1fr) minmax(0, 760px) minmax(min-content, 1fr); }
519+
.art-cols:not(.no-side-nav) { grid-template-columns: minmax(min-content, 1fr) minmax(0, 760px) minmax(min-content, 1fr); }
520520
.art-cols > .rail[data-rail="nav"] { justify-self: start; }
521521
.art-cols > .rail[data-rail="toc"] { justify-self: end; }
522-
/* No sidebar: no reserved left gutter — content leads, TOC trails. The
523-
hidden rail leaves the grid, so the two remaining children auto-place. */
524-
.art-cols.no-side-nav { grid-template-columns: minmax(0, 760px) fit-content(268px); justify-content: center; }
525-
.art-cols.no-side-nav > .rail[data-rail="toc"] { justify-self: start; }
526522
.art-cols > .rail { display: block; position: sticky; top: 68px; align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; }
527523
}
528524
/* Rails scroll invisibly, like the docs — no scrollbar chrome beside the

0 commit comments

Comments
 (0)