Repository navigation
Base Styles: Move Gutenberg from $elevation-* to the shadow tokens - #87894
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +59 B (0%) Total Size: 8.86 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome 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. Navigates the items list via UP/DOWN arrow keys in
|
$elevation-* static and use the shadow tokens in Gutenberg$elevation-* and use the shadow tokens in Gutenberg
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the adaptive shadow-token migration.
No open issues 🎉
What changed in this PR
Deprecates the static Sass elevation variables while preserving their values for external consumers, and migrates Gutenberg surfaces to adaptive shadow tokens.
Changes:
- Documents deprecations and adds Stylelint enforcement with replacement guidance.
- Migrates editor and dashboard shadows, aligning both site editors with the admin background.
- Removes unused base-styles dependencies and updates changelogs.
| File | Description |
|---|---|
| tools/stylelint/config.js | Rejects deprecated shadow variables and suggests tokens. |
| packages/widget-dashboard/src/components/widgets/widgets.module.scss | Uses a token for editable tile shadows. |
| packages/widget-dashboard/src/components/widget-toolbar/widget-toolbar.module.scss | Uses a token for elevated toolbar shadows. |
| packages/widget-dashboard/package.json | Removes unused base-styles dependency. |
| packages/widget-dashboard/CHANGELOG.md | Records dashboard shadow migration. |
| packages/grid/src/dashboard-lanes/lanes.module.scss | Migrates lane drag-preview shadows and animations. |
| packages/grid/src/dashboard-grid/grid.module.scss | Migrates grid drag-preview shadows and animations. |
| packages/grid/package.json | Removes unused base-styles dependency. |
| packages/grid/CHANGELOG.md | Records drag-preview shadow migration. |
| packages/editor/src/components/collaborators-presence/avatar/styles.scss | Migrates avatar shadows. |
| packages/editor/src/components/collaborators-overlay/style.module.scss | Migrates collaborator cursor shadows. |
| packages/editor/src/components/collab-sidebar/style.scss | Migrates selected-note shadows. |
| packages/edit-site/src/components/layout/style.scss | Applies adaptive frame and content-area shadows. |
| packages/edit-site/CHANGELOG.md | Documents adaptive site editor shadows. |
| packages/boot/src/components/root/_layout.module.scss | Resolves canvas shadow under the admin provider. |
| packages/boot/CHANGELOG.md | Documents canvas shadow alignment. |
| packages/block-editor/src/components/writing-flow/style.scss | Migrates canvas stop-hint shadows. |
| packages/block-editor/src/components/inserter/style.scss | Migrates quick-inserter shadows. |
| packages/block-editor/src/components/block-draggable/style.scss | Migrates drag-chip shadows. |
| packages/base-styles/README.md | Explains deprecation and provider-aware migration. |
| packages/base-styles/CHANGELOG.md | Lists deprecated variables and replacements. |
| packages/base-styles/_variables.scss | Marks variables deprecated without changing values. |
| package-lock.json | Synchronizes removed development dependencies. |
Review effort: Balanced
$elevation-* and use the shadow tokens in Gutenberg$elevation-* to the shadow tokens
| const variable = size | ||
| ? `$elevation-${ size }` | ||
| : `$shadow-${ alias }`; | ||
| return `Avoid using the \`${ variable }\` Sass variable. Use \`${ ELEVATION_VARIABLE_REPLACEMENTS[ size ?? alias ] }\` instead, and check that the surface floats over the background of the \`ThemeProvider\` it renders in.`; |
There was a problem hiding this comment.
check that the surface floats over the background
the token is only right when a surface floats over its own provider's background. Someone has to check that for each surface, so a blanket alias isn't safe.
I was initially confused by these things (both what it means, and what I'm supposed to do about it) and had to ask my agent, who pointed me to the Shadows section of the theme package readme. Should we maybe link to that documentation in the message here? I guess it's not that important in this short-lived lint rule, but we'll definitely need to link it in the migration guidance that's coming up for external consumers.
Keep the `$elevation-*` Sass variables at their static values, so code outside Gutenberg doesn't move to the adaptive shadow without a check of the background its surface floats over. Disallow them in Gutenberg with Stylelint, and use the `--wpds-shadow-outer-*` tokens in their place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mark the variables deprecated in favor of the `--wpds-shadow-outer-*` tokens, as the `$modal-width-*` variables were. Their values stay static. Also flag `$shadow-popover` and `$shadow-modal`, add an edit-site changelog entry, and show the token in the base-styles README example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match the site editor frame: the canvas uses `--wpds-shadow-outer-xs`, resolved on `.surfaces` under the admin provider, because the canvas renders inside the content provider but its shadow falls on the admin background. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the changelog entry and the README and source notes that deprecate the `$elevation-*` variables, and word the lint message like the radius one. The public deprecation will land with the other design system variables in a single release.
Say what the token assumes, and link the theme README section that explains what to do when a surface doesn't float over its provider's background.
54f56d6 to
c7db021
Compare
What?
Follow-up to #87287 (follow-ups 3 and 5). Part of #75266.
Disallows the
$elevation-*Sass variables in Gutenberg with Stylelint and moves every Gutenberg use to the--wpds-shadow-outer-*tokens. The variables keep their values, and their public deprecation is left for a later release. The extensible site editor's canvas moves to the same token as the site editor frame.Why?
#87287 asked what to do with the
$elevation-*variables. I compared three options:@wordpress/base-stylesis published.We chose B because the token is only right when a surface floats over its own provider's background. Someone has to check that for each surface, so a blanket alias isn't safe. B lets us check each Gutenberg surface and leaves shadows outside Gutenberg alone. #87492 migrated and linted the
$radius-*variables the same way. The public deprecation and removal will ship later, together with the other design system variables, so consumers migrate once.How?
$shadow-popoverand$shadow-modalaliases don't change. Thebase-styleschangelog and README don't announce a deprecation yet.edit-site) and the canvas (boot) get a stronger shadow on dark admin color schemes. On light schemes thebootcanvas gets slightly softer, to match the frame. The root providers of the post editor and both site editors give the tokens their default values, so popovers and drag chips at the document body don't change.bootcanvas used its own0 1px 3pxshadow. It now uses--wpds-shadow-outer-xs, like theedit-siteframe. The canvas renders inside the content provider, but its shadow falls on the admin background, so.surfacesresolves the token under the admin provider and passes it down in--wp-boot-canvas-shadow.Provider check for each surface
edit-siteboot.surfaces, under the admin providerxsshadow instead of0 1px 3px; stronger on dark schemesblock-editorblock-editorblock-editoreditorgridDragOverlayrenders inline)widget-dashboard#fcfcfc)Other details
--wpds-shadow-outer-sm, so the PRs don't depend on each other, and the merge conflict is easy to resolve.gridandwidget-dashboardno longer import@wordpress/base-styles, so their unused dev dependency is removed.Testing Instructions
npm run lint:css. It passes.box-shadow: $elevation-small;to an SCSS file inpackages/and runnpm run lint:css. It asks you to avoid the variable and namesvar(--wpds-shadow-outer-sm).Testing Instructions for Keyboard
No interaction changes.
Screenshots or screencast
Bottom-left corner of the site editor frame, Coffee scheme, 1440×900 at 2×.
Modern and Blue schemes
On Modern the background is near black, so the shadow stays hard to see even at full strength.
Extensible site editor canvas (Light, Coffee and Modern)
The canvas border carries most of the edge, so the change is subtle. Computed shadow before:
0 1px 3px rgba(0, 0, 0, 0.1)on every scheme. After: thexslayers at about ×1.2, ×2.5 and ×5 strength.Use of AI Tools
Written with Claude Code (Claude Opus 5.5), and reviewed with Codex (GPT-6.2 Astra). Claude compared the options, made the change and took the screenshots. I review it before marking it ready.
🤖 Generated with Claude Code