[Admin UI]: Move to CSS modules and implement logical properties#77088
Conversation
There was a problem hiding this comment.
Pull request overview
Converts @wordpress/admin-ui styling from package-level global SCSS/build-style imports to component-scoped CSS Modules, while also migrating several layout rules to CSS logical properties (LTR/RTL ready). Updates Storybook and downstream packages to stop importing the Admin UI build-style stylesheet.
Changes:
- Refactor Admin UI
PageandBreadcrumbsstyles into.module.scssfiles and update components to consume CSS Modules. - Remove Admin UI build-style stylesheet loading from Storybook and from other packages’ SCSS entrypoints.
- Update
@wordpress/admin-uiTypeScript config and package metadata to support style module imports.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| storybook/package-styles/config.js | Stops lazy-loading Admin UI build-style CSS for admin-ui-* stories. |
| storybook/package-styles/admin-ui-ltr.lazy.scss | Removed Admin UI LTR build-style import file. |
| storybook/package-styles/admin-ui-rtl.lazy.scss | Removed Admin UI RTL build-style import file. |
| packages/interface/src/style.scss | Drops @wordpress/admin-ui/build-style usage from Interface styles aggregation. |
| packages/edit-site/src/style.scss | Drops @wordpress/admin-ui/build-style usage from Edit Site styles aggregation. |
| packages/edit-post/src/style.scss | Drops @wordpress/admin-ui/build-style usage from Edit Post styles aggregation. |
| packages/boot/src/style.scss | Drops @wordpress/admin-ui/build-style usage from Boot styles aggregation. |
| packages/admin-ui/tsconfig.json | Adds style-imports typings for CSS Module imports. |
| packages/admin-ui/src/style.scss | Removes previous package-level SCSS entrypoint that aggregated component styles. |
| packages/admin-ui/src/page/style.module.scss | Introduces CSS Module + logical properties for Page layout and header. |
| packages/admin-ui/src/page/index.tsx | Switches Page to CSS Modules (but currently changes content wrapping behavior). |
| packages/admin-ui/src/page/header.tsx | Switches Header to CSS Modules classes. |
| packages/admin-ui/src/breadcrumbs/style.module.scss | Introduces CSS Module + logical properties for breadcrumbs list styling. |
| packages/admin-ui/src/breadcrumbs/index.tsx | Switches Breadcrumbs to CSS Modules class. |
| packages/admin-ui/README.md | Updates setup instructions to remove Admin UI build-style import guidance. |
| packages/admin-ui/package.json | Updates sideEffects to CSS-module-only SCSS. |
Comments suppressed due to low confidence (1)
packages/admin-ui/src/page/index.tsx:67
- When
hasPaddingis false, the component now returnschildrendirectly (no wrapper). This bypasses the.contentcontainer styles (flex-grow/overflow scrolling), and will likely break layout/scrolling compared to the padded variant. Consider always rendering a content wrapper withstyles.content, and conditionally add thehas-paddingclass when needed.
{ hasPadding ? (
<div
className={ clsx(
styles.content,
styles[ 'has-padding' ]
) }
>
{ children }
</div>
) : (
children
) }
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If 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. |
0992bff to
bd9768f
Compare
|
Flagging potential conflicts with #77012 — @jameskoster and @yogeshbhutkar , you may want to coordinate your efforts |
959a8bf to
be4f32b
Compare
cc1acf5 to
51309fa
Compare
|
Thanks for the review. It looks like the perf test is timing out across all the latest PRs here: https://github.com/WordPress/gutenberg/pulls, so this appears unrelated to this PR. |
) * Update tsconfig.json to include compilerOptions for type definitions * Migrate Breadcrumb styles to SCSS modules and adjust BEM definitions * Migrate admin UI styles for Page to SCSS modules * Refactor to use logical properties * Fix margin properties for breadcrumb separator in SCSS * Remove unintended changes to other modules * Update README.md * Fix linting errors * Remove build-style from package.json files and exports * Update README.md * Remove unintended changes * Fix stylelints * Add CHANGELOG entry * Replace variables with design tokens * Move SCSS modules to CSS * Do not split RTL safe styles * Use CSS modules instead of SCSS in breadcrumbs and header components * Update sideEffects to use CSS modules instead of SCSS * Add className to Page component and update SCSS selector for font library page * Fix module usage * Fix missed lints * Update changelog to reflect breaking changes --- Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>

What?
Closes #77032
Convert the
@wordpress/admin-uipackage to use CSS modules and logical properties.Why?
How?
Testing Instructions
npm run storybook:dev)Screenshots
Note: Before and after changes are expected to be the same.
Use of AI Tools
Used: GH Copilot in ask mode to plan the changes and review them locally.