close
Skip to content

[Admin UI]: Move to CSS modules and implement logical properties#77088

Merged
ciampo merged 22 commits into
WordPress:trunkfrom
yogeshbhutkar:admin-ui-css-refactor
Apr 27, 2026
Merged

[Admin UI]: Move to CSS modules and implement logical properties#77088
ciampo merged 22 commits into
WordPress:trunkfrom
yogeshbhutkar:admin-ui-css-refactor

Conversation

@yogeshbhutkar
Copy link
Copy Markdown
Contributor

@yogeshbhutkar yogeshbhutkar commented Apr 7, 2026

What?

Closes #77032

Convert the @wordpress/admin-ui package to use CSS modules and logical properties.

Why?

  • Simpler setup for consumers
  • Better maintainability with scoped styles eliminates the need for downstream class overrides
  • Logical properties (margin-inline-start, block-size, etc.) make setup LTR/RTL ready

How?

  • Refactor style.scss into component-scoped .module.css files
  • Replace physical properties (left, top, margin-left) with logical equivalents (inline-start, block-start, margin-inline-start)
  • Update component imports to use CSS module syntax

Testing Instructions

  1. Run the Storybook (npm run storybook:dev)
  2. Navigate to Admin UI → Breadcrumbs, and verify styles load as intended
  3. Navigate to Admin UI → Page, and verify styles load as intended

Screenshots

Before After
before after
before-1 after-1

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.

@github-actions github-actions Bot added [Package] Edit Post /packages/edit-post [Package] Interface /packages/interface [Package] Edit Site /packages/edit-site labels Apr 7, 2026
@yogeshbhutkar yogeshbhutkar added [Type] Code Quality Issues or PRs that relate to code quality [Package] Admin UI /packages/admin-ui labels Apr 7, 2026
@yogeshbhutkar yogeshbhutkar self-assigned this Apr 7, 2026
@yogeshbhutkar yogeshbhutkar requested a review from Copilot April 7, 2026 09:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Page and Breadcrumbs styles into .module.scss files 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-ui TypeScript 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 hasPadding is false, the component now returns children directly (no wrapper). This bypasses the .content container styles (flex-grow/overflow scrolling), and will likely break layout/scrolling compared to the padded variant. Consider always rendering a content wrapper with styles.content, and conditionally add the has-padding class 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.

Comment thread packages/admin-ui/README.md Outdated

This comment was marked as resolved.

Comment thread packages/admin-ui/src/breadcrumbs/index.tsx
Comment thread packages/admin-ui/src/page/style.module.scss Outdated
@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review April 7, 2026 11:22
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

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 props-bot label.

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: 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>

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

@yogeshbhutkar yogeshbhutkar requested review from a team, aduth and mirka April 7, 2026 11:22
Comment thread packages/admin-ui/src/breadcrumbs/index.tsx
Comment thread packages/admin-ui/src/breadcrumbs/style.module.scss Outdated
Comment thread packages/admin-ui/src/breadcrumbs/style.module.css
Comment thread packages/admin-ui/src/page/style.module.scss Outdated
Comment thread packages/admin-ui/src/page/style.module.scss Outdated
Comment thread packages/admin-ui/src/breadcrumbs/style.module.css
@ciampo
Copy link
Copy Markdown
Contributor

ciampo commented Apr 14, 2026

Flagging potential conflicts with #77012@jameskoster and @yogeshbhutkar , you may want to coordinate your efforts

@yogeshbhutkar yogeshbhutkar force-pushed the admin-ui-css-refactor branch from 959a8bf to be4f32b Compare April 20, 2026 04:07
@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review April 20, 2026 08:13
@yogeshbhutkar yogeshbhutkar requested a review from mirka April 20, 2026 08:54
@yogeshbhutkar yogeshbhutkar force-pushed the admin-ui-css-refactor branch from cc1acf5 to 51309fa Compare April 27, 2026 05:09
@yogeshbhutkar yogeshbhutkar requested a review from ciampo April 27, 2026 06:46
Copy link
Copy Markdown
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@yogeshbhutkar
Copy link
Copy Markdown
Contributor Author

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.

@ciampo ciampo enabled auto-merge (squash) April 27, 2026 13:45
@ciampo ciampo disabled auto-merge April 27, 2026 13:45
@ciampo ciampo merged commit 542e49d into WordPress:trunk Apr 27, 2026
41 of 44 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.1 milestone Apr 27, 2026
@yogeshbhutkar yogeshbhutkar deleted the admin-ui-css-refactor branch April 29, 2026 04:15
t-hamano pushed a commit that referenced this pull request Apr 29, 2026
)

* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Admin UI /packages/admin-ui [Package] Edit Post /packages/edit-post [Package] Edit Site /packages/edit-site [Package] Interface /packages/interface [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin UI: Move to CSS modules

5 participants