Skip to content

Replace $default-font with the font family body token - #87490

Merged
mirka merged 6 commits into
trunkfrom
replace-default-font-with-body-token
Dec 3, 2026
Merged

mirka merged 6 commits into
trunkfrom
replace-default-font-with-body-token

Conversation

@mirka

@mirka mirka commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

What?

Follow-up to #86761.

Replaces the uses of the $default-font Sass variable from @wordpress/base-styles with the --wpds-typography-font-family-body design token, and extends the Stylelint rule for the font family variables to reject $default-font in declaration values too.

Why?

$default-font is an alias of $font-family-body, which #86761 already replaced with the token. Moving its call sites now, and preventing new ones, prepares for deprecating the variable. The variable itself stays in @wordpress/base-styles until then.

How?

The input-control mixin in @wordpress/base-styles uses the package's wpds.var() helper instead of a bare var(), like the other token references in that file, because stylesheets built outside Gutenberg do not get the token fallbacks that the Gutenberg build adds.

Testing Instructions

  1. In Storybook, open the Snackbar, Placeholder, and @wordpress/components Tooltip (Components/@wordpress-components/Deprecated/Tooltip) stories and check that the text renders in the system font as before.
  2. In the post editor, insert a More block and check that its "Read more" label uses the system font, as before.
  3. In the widgets editor, check that the widget area titles use the system font, as before.
  4. Add font-family: $default-font; to any stylesheet and run npm run lint:css. It reports an error that suggests var(--wpds-typography-font-family-body).

Screenshots or screencast

The token value matches the Sass variable, so the components render the same as before.

Before After
Snackbar with a one-line message, before Snackbar with a one-line message, after
Placeholder with a label, instructions, and a text field, before Placeholder with a label, instructions, and a text field, after

Swap call sites of the `$default-font` Sass variable from
`@wordpress/base-styles` for `var(--wpds-typography-font-family-body)`,
and extend the Stylelint rule for the font family variables to reject
`$default-font` too. The variable definition stays unchanged until its
deprecation.
@mirka mirka added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor [Package] Base styles /packages/base-styles labels Nov 26, 2026
@mirka mirka self-assigned this Nov 26, 2026
@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Edit Post /packages/edit-post [Package] Edit Widgets /packages/edit-widgets [Package] Edit Site /packages/edit-site labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +209 B (0%)

Total Size: 8.85 MB

📦 View Changed
Filename Size Change
build/scripts/components/index.min.js 358 kB +57 B (+0.02%)
build/scripts/edit-post/index.min.js 45.1 kB +6 B (+0.01%)
build/scripts/edit-widgets/index.min.js 85.8 kB -7 B (-0.01%)
build/scripts/editor/index.min.js 575 kB -34 B (-0.01%)
build/styles/block-editor/content-rtl.css 6.08 kB +11 B (+0.18%)
build/styles/block-editor/content-rtl.min.css 4.57 kB +21 B (+0.46%)
build/styles/block-editor/content.css 6.08 kB +11 B (+0.18%)
build/styles/block-editor/content.min.css 4.56 kB +21 B (+0.46%)
build/styles/block-editor/style-rtl.css 20.6 kB +17 B (+0.08%)
build/styles/block-editor/style-rtl.min.css 17.5 kB +39 B (+0.22%)
build/styles/block-editor/style.css 20.6 kB +17 B (+0.08%)
build/styles/block-editor/style.min.css 17.5 kB +40 B (+0.23%)
build/styles/block-library/editor-rtl.css 13.1 kB +14 B (+0.11%)
build/styles/block-library/editor-rtl.min.css 10.8 kB +19 B (+0.18%)
build/styles/block-library/editor.css 13.1 kB +14 B (+0.11%)
build/styles/block-library/editor.min.css 10.7 kB +20 B (+0.19%)
build/styles/block-library/more/editor-rtl.css 830 B +11 B (+1.34%)
build/styles/block-library/more/editor-rtl.min.css 434 B +16 B (+3.83%)
build/styles/block-library/more/editor.css 831 B +10 B (+1.22%)
build/styles/block-library/more/editor.min.css 434 B +16 B (+3.83%)
build/styles/block-library/navigation/editor-rtl.css 3.41 kB +12 B (+0.35%)
build/styles/block-library/navigation/editor-rtl.min.css 2.33 kB +22 B (+0.95%)
build/styles/block-library/navigation/editor.css 3.41 kB +11 B (+0.32%)
build/styles/block-library/navigation/editor.min.css 2.33 kB +25 B (+1.09%)
build/styles/block-library/nextpage/editor-rtl.css 835 B +11 B (+1.33%)
build/styles/block-library/nextpage/editor-rtl.min.css 435 B +16 B (+3.82%)
build/styles/block-library/nextpage/editor.css 836 B +11 B (+1.33%)
build/styles/block-library/nextpage/editor.min.css 435 B +16 B (+3.82%)
build/styles/components/style-rtl.css 18.7 kB -21 B (-0.11%)
build/styles/components/style-rtl.min.css 15.8 kB -3 B (-0.02%)
build/styles/components/style.css 18.7 kB -8 B (-0.04%)
build/styles/components/style.min.css 15.8 kB -10 B (-0.06%)
build/styles/edit-post/style-rtl.css 3.49 kB +10 B (+0.29%)
build/styles/edit-post/style-rtl.min.css 2.16 kB +20 B (+0.93%)
build/styles/edit-post/style.css 3.5 kB +12 B (+0.34%)
build/styles/edit-post/style.min.css 2.16 kB +25 B (+1.17%)
build/styles/edit-site/style-rtl.css 21.7 kB -8 B (-0.04%)
build/styles/edit-site/style-rtl.min.css 17.7 kB +2 B (+0.01%)
build/styles/edit-site/style.css 21.7 kB -8 B (-0.04%)
build/styles/edit-site/style.min.css 17.7 kB +1 B (+0.01%)
build/styles/edit-widgets/style-rtl.css 5.46 kB -22 B (-0.4%)
build/styles/edit-widgets/style-rtl.min.css 4.06 kB -21 B (-0.51%)
build/styles/edit-widgets/style.css 5.46 kB -22 B (-0.4%)
build/styles/edit-widgets/style.min.css 4.06 kB -22 B (-0.54%)
build/styles/editor/style-rtl.css 32.8 kB -24 B (-0.07%)
build/styles/editor/style-rtl.min.css 28.5 kB -23 B (-0.08%)
build/styles/editor/style.css 32.9 kB -25 B (-0.08%)
build/styles/editor/style.min.css 28.4 kB -25 B (-0.09%)
build/styles/widgets/style-rtl.css 2.3 kB -19 B (-0.82%)
build/styles/widgets/style-rtl.min.css 1.32 kB -12 B (-0.9%)
build/styles/widgets/style.css 2.3 kB -18 B (-0.78%)
build/styles/widgets/style.min.css 1.32 kB -13 B (-0.97%)

fe347fb Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 8ed92d1 trunk % Change
timeToFirstByte 56.75 ms +5.29% -2.03% 57.7 ms +7.63% -3.12% -1.65%
largestContentfulPaint 90 ms +4.44% -6.67% 88 ms +4.55% -4.55% 2.27%
lcpMinusTtfb 30.15 ms +21.39% -8.29% 28.9 ms +4.15% -4.33% 4.33%
wpBeforeTemplate 30.04 ms +6.42% -1% 30.77 ms +7.73% -3.05% -2.37%
wpTemplate 22.51 ms +3.38% -3.24% 22.88 ms +3.93% -2.14% -1.62%
wpTotal 52.92 ms +2.68% -2.66% 53.94 ms +7.32% -3.24% -1.89%
wpMemoryUsage 7.76 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 8ed92d1 trunk % Change
timeToFirstByte 48 ms +8.65% -2.71% 48.05 ms +6.87% -0.83% -0.1%
largestContentfulPaint 84 ms +4.76% -0% 84 ms +4.76% -0% 0%
lcpMinusTtfb 37 ms +2.03% -4.46% 36.15 ms +1.38% -2.77% 2.35%
wpBeforeTemplate 27.9 ms +10.36% -2.97% 27.86 ms +1.69% -0.75% 0.14%
wpTemplate 17.04 ms +3.46% -5.69% 16.82 ms +4.34% -1.78% 1.31%
wpTotal 44.66 ms +9.09% -1.75% 44.95 ms +4.85% -1.07% -0.65%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 8ed92d1 trunk % Change
mediaProcessingJpeg 400.58 ms +0.2% -0.99% 402.14 ms +0.66% -0.61% -0.39%
mediaProcessingAvif 6176.47 ms +0.07% -0.38% 6157.19 ms +0.3% -0.24% 0.31%
mediaProcessingJpegToAvif 4247.44 ms +0.26% -0.11% 4242.53 ms +0.39% -0.14% 0.12%

media-upload

Metric 8ed92d1 trunk % Change
jpegUploadProcessing 2021.93 ms +0.81% -25.24% 1539.83 ms +27.88% -1.29% 31.31%
pngUploadProcessing 276.46 ms +3.35% -5.9% 282.62 ms +4.76% -5.33% -2.18%
largeJpegUploadProcessing 1756.91 ms +12.98% -13.25% 1764.01 ms +12.33% -13.69% -0.4%
multipleImageUploadProcessing 2062.01 ms +1.89% -0.49% 2102.45 ms +1.87% -0.57% -1.92%

post-editor

Metric 8ed92d1 trunk % Change
serverResponse 480.15 ms +4.45% -4.18% 488.36 ms +1.9% -9.26% -1.68%
firstPaint 435.7 ms +4.31% -7.21% 444.12 ms +2.5% -9.48% -1.9%
domContentLoaded 846.55 ms +3.7% -1.33% 813.64 ms +1.34% -0.39% 4.04%
loaded 848.49 ms +3.64% -1.37% 815.44 ms +1.35% -0.42% 4.05%
firstContentfulPaint 476.88 ms +2.1% -3.06% 457.49 ms +0.83% -2.27% 4.24%
firstBlock 2307.99 ms +2.05% -2.97% 2225.28 ms +1.44% -1.16% 3.72%
type 17 ms +5.94% -8.41% 16.8 ms +6.79% -4.46% 1.19%
typeWithoutInspector 17.67 ms +2.49% -11.15% 18.05 ms +13.68% -14.07% -2.11%
typeWithTopToolbar 22.4 ms +5.13% -10.27% 23.36 ms +5.14% -7.75% -4.11%
typeContainer 8.05 ms +14.66% -6.96% 8.57 ms +16.57% -15.29% -6.07%
focus 114.03 ms +3.23% -13.07% 106.38 ms +3.83% -2.74% 7.19%
firstFocus 271.06 ms +0% -0% 267.12 ms +0% -0% 1.47%
selectAll 426 ms +1.66% -2.89% 404.24 ms +2.49% -2.13% 5.38%
undo 28.71 ms +5.15% -2.37% 28.54 ms +3.33% -4.98% 0.6%
listViewOpen 39.12 ms +9.84% -6.08% 41.6 ms +3.58% -8.85% -5.96%
inserterOpen 38.46 ms +9.07% -3.9% 41.3 ms +4.62% -10.51% -6.88%
inserterHover 11.5 ms +6.17% -8.96% 10.54 ms +13.09% -6.17% 9.11%
inserterSearch 8.68 ms +6.68% -13.94% 7.93 ms +13.49% -4.92% 9.46%
loadPatterns 646.73 ms +0.97% -2.22% 637.16 ms +3.18% -2.51% 1.5%
wpTotal 469.64 ms +4.7% -4.16% 478.48 ms +1.7% -9.41% -1.85%
wpMemoryUsage 14.80 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 8ed92d1 trunk % Change
serverResponse 312.79 ms +1.53% -9.65% 314.88 ms +2.25% -9.42% -0.66%
firstPaint 365.7 ms +2.73% -15.1% 368.24 ms +3.13% -19.26% -0.69%
domContentLoaded 649.91 ms +8.17% -1.43% 656.92 ms +2.08% -0.96% -1.07%
loaded 651.19 ms +8.14% -1.45% 658.21 ms +2.05% -0.98% -1.07%
firstContentfulPaint 371.18 ms +8.21% -2.02% 374.29 ms +1.46% -3.31% -0.83%
firstBlock 1983.18 ms +10.02% -0.39% 2039.5 ms +0.86% -1.49% -2.76%
type 15.78 ms +4.75% -8.81% 15.05 ms +4.92% -8.37% 4.85%
navigate 98.35 ms +1.78% -10.15% 95.33 ms +13.95% -6.41% 3.17%
loadPatterns 1253.57 ms +4.66% -7.77% 1240.81 ms +9.27% -12.55% 1.03%
loadPages 1005.85 ms +3.23% -1.03% 1006.43 ms +1.06% -0.56% -0.06%
wpTotal 304.52 ms +1.56% -9.91% 306.56 ms +2.31% -9.65% -0.67%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

fe347fb Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

As a user I want to be able to create a navigation overlay for a specific navigation block in /test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('region', { name: /(Editor publish|Save panel)/ }).getByRole('button', { name: 'Save', exact: true })

    at Editor.saveSiteEditorEntities (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/site-editor.ts:48:5)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js:91:4
lets a zero rotation undo the fit of a Global Styles rotation in /test/e2e/specs/editor/various/block-transform.spec.ts, passed after 1 failed attempt.
Error: Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/block-transform.spec.ts:370:6

fe347fb Run

@mirka
mirka marked this pull request as ready for review December 2, 2026 19:01
@mirka
mirka requested review from a team, ellatrix and manzoorwanijk as code owners December 2, 2026 19:01
@github-actions
github-actions Bot requested review from aduth and ciampo December 2, 2026 19:02

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

Just a heads-up about this PR needing a rebase which may not be straighforward, making sure that all CHANGELOG entries are moved to the new Unreleased section and that the new color changes from #87817 are preserved in Tooltip

@mirka
mirka enabled auto-merge (squash) December 3, 2026 09:04
@mirka
mirka merged commit 97f175c into trunk Dec 3, 2026
85 checks passed
@mirka
mirka deleted the replace-default-font-with-body-token branch December 3, 2026 09:15
@github-actions github-actions Bot added this to the Gutenberg 24.7 milestone Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Base styles /packages/base-styles [Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Components /packages/components [Package] Edit Post /packages/edit-post [Package] Edit Site /packages/edit-site [Package] Edit Widgets /packages/edit-widgets [Package] Editor /packages/editor [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants