Skip to content

Jetpack: resolve WPDS design tokens in legacy dashboard CSS#48750

Merged
CGastrell merged 1 commit into
trunkfrom
change/dashboard-load-design-tokens
Jun 4, 2026
Merged

Jetpack: resolve WPDS design tokens in legacy dashboard CSS#48750
CGastrell merged 1 commit into
trunkfrom
change/dashboard-load-design-tokens

Conversation

@CGastrell
Copy link
Copy Markdown
Contributor

@CGastrell CGastrell commented May 13, 2026

Part of #49285. Companion to #49345 (the runtime half).

Proposed changes

This is the build-time half of WPDS-token loading, scoped to the legacy _inc/ dashboard (Settings / Dashboard / Debugger).

  • projects/plugins/jetpack/tools/postcss.config.js: add @wordpress/theme/design-tokens.css to the @csstools/postcss-global-data files list (alongside the existing calypso-color-schemes entry).
  • projects/plugins/jetpack/package.json: add @wordpress/theme@0.13.0 as a direct dependency so require.resolve( '@wordpress/theme/design-tokens.css' ) (exposed via the package's exports map) resolves deterministically.

Why build-time here (and runtime elsewhere)

The _inc/ dashboard's postcss runs postcss-custom-properties with preserve: false, which inlines var(--wpds-*, #fallback) to its hex fallback at build time and strips the var(). So on the legacy dashboard, token-based colors (e.g. Hello Dolly) were baked to #87a6bc and a runtime :root{--wpds-*} stylesheet has nothing to bind to.

Feeding the tokens into postcss-global-data makes postcss-custom-properties inline them to the actual token value (#707070) instead of the fallback.

The obvious alternative — flipping preserve: true so vars survive to runtime — is not viable here: @automattic/calypso-color-schemes (732 generic vars like --color-text) is only build-time-inlined and not loaded at runtime, so preserving would leave every no-fallback calypso var undefined → broken. That's the exact "extremely generic vars" blocker called out in the existing postcss.config.js comment. The modernized admin-ui pages don't have this constraint (they preserve var() and load tokens at runtime), so they get the runtime stylesheet in #49345 instead.

No version skew: both this build-time source and #49345's runtime source come from @wordpress/theme@0.13.0.

Verification

Rebuilt _inc/build/admin.css:

Before (trunk) After
#87a6bc (Dolly fallback) occurrences present 0
#707070 (token value) occurrences 0 6

Standalone postcss check of the config also confirms .dolly{ color: var(--wpds-color-fg-content-neutral-weak, #87a6bc) }color:#707070, while a generic var(--color-text) stays inlined (unchanged) — i.e. no calypso regression.

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  1. pnpm jetpack build plugins/jetpack (the CSS/webpack step; an unrelated composer build-development step may fail locally).
  2. grep -c 87a6bc projects/plugins/jetpack/_inc/build/admin.css0; grep -c 707070 … → non-zero.
  3. On a connected site, hard-refresh Jetpack → Settings / Dashboard and the Debugger: the Hello Dolly strip reads #707070 (neutral gray) instead of the old bluish #87a6bc.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the change/dashboard-load-design-tokens branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/dashboard-load-design-tokens
bin/jetpack-downloader test jetpack-mu-wpcom-plugin change/dashboard-load-design-tokens

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress labels May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 13, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 13, 2026

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@CGastrell CGastrell force-pushed the change/dashboard-load-design-tokens branch from 0eed05d to 0bd237c Compare May 18, 2026 13:54
@CGastrell CGastrell force-pushed the change/dashboard-load-design-tokens branch from 0bd237c to 42ff3eb Compare May 29, 2026 20:35
@CGastrell CGastrell force-pushed the change/dashboard-load-design-tokens branch from 42ff3eb to 9c6a7ee Compare June 2, 2026 18:05
@CGastrell CGastrell marked this pull request as ready for review June 2, 2026 19:47
@CGastrell CGastrell added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Jun 2, 2026
@CGastrell CGastrell force-pushed the change/dashboard-load-design-tokens branch from 9c6a7ee to ce51425 Compare June 2, 2026 22:51
@CGastrell CGastrell self-assigned this Jun 3, 2026
@CGastrell CGastrell force-pushed the change/dashboard-load-design-tokens branch from ce51425 to 7d06c03 Compare June 3, 2026 13:49
Feed @wordpress/theme/design-tokens.css into the _inc postcss-global-data so
postcss-custom-properties inlines var(--wpds-*, #fallback) to the actual token
value (e.g. #707070) instead of the hand-written hex fallback. The legacy _inc
dashboard build strips var() (preserve:false) and otherwise has no runtime token
source, so token-based colors like Hello Dolly were baked to their fallback
(#87a6bc). Modernized admin-ui pages get tokens at runtime via a shared
stylesheet instead; preserve:true cannot be used here because calypso-color-
schemes' generic vars are not loaded at runtime.

Part of #49285.
@CGastrell CGastrell force-pushed the change/dashboard-load-design-tokens branch from 7d06c03 to 7aae723 Compare June 4, 2026 12:56
@CGastrell CGastrell merged commit 390f682 into trunk Jun 4, 2026
122 of 123 checks passed
@CGastrell CGastrell deleted the change/dashboard-load-design-tokens branch June 4, 2026 13:39
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Jun 4, 2026
CGastrell added a commit that referenced this pull request Jun 5, 2026
Remove the two legacy Hello Dolly rules now that WPDS design tokens load on
every Jetpack admin page (#48750 build-time for the legacy _inc pages,
#49345 runtime for modernized pages):

- `.wp-admin #dolly` (admin-static.scss, static #87a6bc)
- `.jetpack-pagestyles #dolly` (_main.scss, $gray ~= #a1a1a1)

The central `.jetpack-admin-page #dolly` rule (token-based, resolves to
#707070) now governs consistently. The legacy rules only competed with it
at equal specificity. Their `position: relative` used all-zero offsets
(visually identical to static), so removal causes no layout shift; Dolly
converges to #707070 with hello.php's default padding, and the central
rule's `@media (max-width: 659px) { display: none }` already covers the
breakpoint the legacy rules handled.

My Jetpack's `p#dolly { display: none }` and JITM adjacency are untouched.

Verified live on the dev site: Dashboard #dolly computed color #707070,
same top/left/width as baseline (no positioning regression).

Part of #49285 (Phase 4).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant