Skip to content

Commit 4f96f6d

Browse files
v6: Make the font-size setting reach body text (#4427)
## Summary - `--font-size-body` is declared twice: as a scaling preset token in `tokens.css` (`:root, [data-font-size='default'|'compact'|'large'|'xl']`), and as a frozen v5 value in `root.css`'s DEPRECATED `.graphiql-container` block. Both selectors have specificity (0,1,0) and the frozen block comes later (after `@import 'tokens.css'`), so `calc(15rem / 16)` always won. - Every consumer of `var(--font-size-body)` — the `.graphiql-container` base font-size, `button`, `dialog`, `dropdown-menu`, `top-bar`, and the collections / doc-explorer / query-builder plugins — has silently been pinned to 15px, so Settings > Font size never touched body text even though the code looked correct. The sibling preset tokens (`--font-size-small`, `--font-size-mono`, `--font-size-eyebrow`) were unaffected because they aren't redeclared in that block. - Renaming the frozen declaration separates the two meanings and lets the preset token win. ## Changes - `root.css`: renamed `--font-size-body: calc(15rem / 16)` to `--font-size-body-legacy` in the DEPRECATED `.graphiql-container` block. - `graphiql-plugin-code-exporter/src/index.css`: pointed the CodeMirror-based plugin at `var(--font-size-body-legacy)` so it keeps rendering at the frozen 15px. - Updated the DEPRECATED block comment to name the code-exporter plugin — the explorer plugin it referenced no longer consumes this token. ## Validation Steps 1. Open the app and note the size of body text (panel headers, buttons, top bar, doc explorer rows). 2. Open Settings > Font size and switch to **Large**, then **Extra large**. Body text throughout the app should visibly grow at each step — previously it stayed fixed at 15px regardless. 3. Switch to **Compact**. Body text should visibly shrink. 4. Switch back to **Default** and confirm body text settles at the standard size (slightly smaller than before this change). 5. Open the code exporter plugin and cycle through the font-size presets. Its exported-code panel should stay the same size at every preset — it intentionally remains frozen.
1 parent ff2e4ca commit 4f96f6d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/graphiql-plugin-code-exporter/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
& > div {
2525
font-family: var(--font-family) !important;
2626
padding: 0 !important;
27-
font-size: var(--font-size-body) !important;
27+
font-size: var(--font-size-body-legacy) !important;
2828
}
2929
& > div:first-of-type {
3030
display: flex;

packages/graphiql-react/src/style/root.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* via PortalProvider, so they inherit these variables through DOM ancestry.
1414
*/
1515
.graphiql-container {
16-
/* DEPRECATED (v5): retained frozen for backward compatibility and the CodeMirror-based explorer plugin. Do not add new usages — use the OKLCH tokens in tokens.css. */
16+
/* DEPRECATED (v5): retained frozen for backward compatibility and the CodeMirror-based code-exporter plugin. Do not add new usages — use the OKLCH tokens in tokens.css. */
1717
/* Colors */
1818
--color-primary: 320, 95%, 43%;
1919
--color-secondary: 242, 51%, 61%;
@@ -36,7 +36,8 @@
3636
--font-family: 'Roboto', sans-serif;
3737
--font-family-mono: 'Fira Code', monospace;
3838
--font-size-inline-code: calc(13rem / 16);
39-
--font-size-body: calc(15rem / 16);
39+
/* Renamed off the v6 preset name `--font-size-body` (tokens.css) so this frozen v5 value stops overriding it on `.graphiql-container` at equal specificity. Only the legacy code-exporter plugin consumes it. */
40+
--font-size-body-legacy: calc(15rem / 16);
4041
--font-size-h4: calc(18rem / 16);
4142
--font-size-h3: calc(22rem / 16);
4243
--font-size-h2: calc(29rem / 16);

0 commit comments

Comments
 (0)