Skip to content

SEO: migrate dashboard styles to CSS Modules - #50617

Merged
gmjuhasz merged 3 commits into
trunkfrom
gmjuhasz/audit-seo-antipatterns
Jul 21, 2026
Merged

SEO: migrate dashboard styles to CSS Modules#50617
gmjuhasz merged 3 commits into
trunkfrom
gmjuhasz/audit-seo-antipatterns

Conversation

@gmjuhasz

@gmjuhasz gmjuhasz commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

  • Migrate the shared dashboard loading/error states plus the Overview and Content screens from global SCSS to CSS Modules.
  • Import shared modules directly in each wp-build consumer, keep only the admin page layout global, and remove unused AI/SERP class hooks.
  • Remove WPDS token fallbacks and use logical sizing/spacing while preserving behavior, measurements, colors, and responsive layouts.

Related product discussion/links

  • None.

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

No.

Testing instructions

  • Run pnpm exec eslint projects/packages/seo.
  • Run pnpm exec stylelint 'projects/packages/seo/_inc/**/*.{css,scss,sass}'.
  • Run pnpm --filter @automattic/jetpack-seo run typecheck.
  • Run pnpm --filter @automattic/jetpack-seo run test --runInBand.
  • Run jp build packages/seo --deps.
  • In the isolated Docker environment, check Overview cards and coverage rings plus the Content table and inspector at desktop and narrow widths.
  • Confirm the tab strip remains sticky, Content remains full-bleed, and the shared loading/error states appear by removing a preloaded Overview response and delaying or blocking its REST request. Verify reduced motion disables the skeleton animation and retry recovers in place.

We also moved to using UI components instead of bare css where possible so sanity test UI:

Test these areas in Jetpack → SEO:

Overview

  • Site Visibility and Site Verification cards remain equal-height.
  • Status dots/labels align correctly.
  • Manage buttons stay bottom-right.
  • Content SEO rings, labels, empty state, and Disable SEO line.
  • Enable SEO card when SEO tools are disabled.
  • Narrow viewport: cards and rings wrap cleanly.

Content → open a post inspector

  • Header and close button alignment.
  • Field spacing and right-aligned Cancel/Save buttons.
  • SERP preview URL, blue title, description, and empty-title/description states.
  • Check desktop and narrow inspector widths.

Settings → Search & social previews

  • Expand the card and inspect Google, Facebook, and X headings/icons.
  • Check borders, typography, spacing, favicon/image states.
  • Edit the front-page description and confirm all previews update live.

@gmjuhasz gmjuhasz self-assigned this Jul 17, 2026
@gmjuhasz gmjuhasz added [Status] Needs Review This PR is ready for review. Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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), and enable the gmjuhasz/audit-seo-antipatterns branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack gmjuhasz/audit-seo-antipatterns

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

Copy link
Copy Markdown
Contributor

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!

@jp-launch-control

Copy link
Copy Markdown

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

@gmjuhasz
gmjuhasz requested review from a team and Copilot July 17, 2026 11:37
@gmjuhasz
gmjuhasz marked this pull request as ready for review July 17, 2026 11:37

Copilot AI 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.

Pull request overview

This PR migrates Jetpack SEO dashboard UI styling from global SCSS selectors to scoped CSS Modules, focusing on the shared loading/error states and the Overview + Content screens while keeping the admin page layout styles global.

Changes:

  • Convert Overview and Content screen styles to CSS Modules and update components to reference module class names.
  • Convert shared loading/error UI (skeleton + load error) to CSS Modules and remove old global SCSS files.
  • Remove unused legacy class hooks (e.g., AI screen wrapper class) and modernize styles with logical properties.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
projects/packages/seo/changelog/migrate-seo-dashboard-styles-to-css-modules Adds changelog entry describing the migration (format needs a blank line after headers).
projects/packages/seo/_inc/screens/overview/style.module.scss Replaces global Overview selectors with module-scoped classes and logical properties.
projects/packages/seo/_inc/screens/overview/status-dot.tsx Switches StatusDot styling from global SCSS import to CSS Module classes.
projects/packages/seo/_inc/screens/overview/status-dot.scss Removes old global StatusDot styles.
projects/packages/seo/_inc/screens/overview/status-dot.module.scss Adds module-scoped StatusDot styles.
projects/packages/seo/_inc/screens/overview/site-visibility-card.tsx Updates footer styling to use Overview CSS Module.
projects/packages/seo/_inc/screens/overview/site-verification-card.tsx Updates stat row + footer styling to use Overview CSS Module.
projects/packages/seo/_inc/screens/overview/index.tsx Replaces global Overview wrapper/grid/content-card classes with module classes.
projects/packages/seo/_inc/screens/overview/disable-seo-tools.tsx Updates disable/off-ramp styling to use Overview CSS Module.
projects/packages/seo/_inc/screens/overview/content-coverage-card.tsx Updates coverage ring layout/styling to use Overview CSS Module.
projects/packages/seo/_inc/screens/content/style.scss Removes old global Content screen styles.
projects/packages/seo/_inc/screens/content/style.module.scss Adds module-scoped Content screen + inspector + SERP preview styles.
projects/packages/seo/_inc/screens/content/serp-preview.tsx Switches SERP preview styling to Content CSS Module classes.
projects/packages/seo/_inc/screens/content/seo-inspector.tsx Switches inspector layout/styling to Content CSS Module classes.
projects/packages/seo/_inc/screens/content/index.tsx Switches Content screen root wrapper to CSS Module class.
projects/packages/seo/_inc/screens/ai/index.tsx Removes unused jetpack-seo-ai wrapper class hook.
projects/packages/seo/_inc/dashboard/dashboard-page.tsx Uses clsx for conditional global layout class composition.
projects/packages/seo/_inc/components/dashboard-skeleton.tsx Switches skeleton styling from global SCSS import to CSS Module classes.
projects/packages/seo/_inc/components/dashboard-skeleton.scss Removes old global skeleton styles.
projects/packages/seo/_inc/components/dashboard-skeleton.module.scss Adds module-scoped skeleton styles (including reduced-motion handling).
projects/packages/seo/_inc/components/dashboard-load-error.tsx Switches load-error styling from global SCSS import to CSS Module classes.
projects/packages/seo/_inc/components/dashboard-load-error.scss Removes old global load-error styles.
projects/packages/seo/_inc/components/dashboard-load-error.module.scss Adds module-scoped load-error styles.

@simison

simison commented Jul 17, 2026

Copy link
Copy Markdown
Member

Remove WPDS token fallbacks and use logical sizing/spacing while preserving behavior, measurements, colors, and responsive layouts.

Sorry, did already in #50634 and also added folder to the linter rule about thoes fallbacks. :-)

Comment thread projects/packages/seo/_inc/components/dashboard-load-error.module.scss Outdated
Comment on lines +12 to +16
.title {
margin: 0;
font-size: 20px;
font-weight: 600;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can likely just be <Text> and no need styles at all.

Comment thread projects/packages/seo/_inc/components/dashboard-load-error.module.scss Outdated
Comment on lines +7 to +18
// Visually hidden, but announced by screen readers via the role="status".
.label {
position: absolute;
inline-size: 1px;
block-size: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can just use VisuallyHidden component from @wordpress/ui.

Comment thread projects/packages/seo/_inc/components/dashboard-skeleton.module.scss Outdated
Comment thread projects/packages/seo/_inc/components/dashboard-skeleton.module.scss Outdated
Comment thread projects/packages/seo/_inc/components/dashboard-skeleton.module.scss Outdated
Comment thread projects/packages/seo/_inc/components/dashboard-skeleton.module.scss Outdated
Comment thread projects/packages/seo/_inc/screens/content/style.module.scss Outdated
Comment thread projects/packages/seo/_inc/screens/content/style.module.scss Outdated
Comment thread projects/packages/seo/_inc/screens/content/style.module.scss Outdated
Comment thread projects/packages/seo/_inc/screens/content/style.module.scss Outdated
Comment thread projects/packages/seo/_inc/screens/content/style.module.scss Outdated
@simison

simison commented Jul 17, 2026

Copy link
Copy Markdown
Member

I know it's not because of this PR that those are in (so really not a blocker, just suggestion for follow up): I took the opportunity to comment where you could use @wordprses/ui components instead. You probably won't need half or 1/3 of the CSS seen here. :-)

gmjuhasz added 2 commits July 20, 2026 10:44
…ntipatterns

# Conflicts:
#	projects/packages/seo/_inc/screens/content/style.scss
#	projects/packages/seo/_inc/screens/overview/style.module.scss
@gmjuhasz

Copy link
Copy Markdown
Contributor Author

Hey @simison, thanks for the review. This PR originally started as a dumber refactor to migrate to CSS modules, but I completely agree on all your points, so I increased the scope here to also use built-in components where possible. If you have the time the take another peek, that would be appreciated :)

@gmjuhasz
gmjuhasz requested a review from simison July 20, 2026 09:21
@simison

simison commented Jul 20, 2026

Copy link
Copy Markdown
Member

Awesome! I'll be AFK until next week but just check if visual output looks similar enough or check with Jetpack design to confirm if in doubt. 🙂 Also remember to check mobile.

@gmjuhasz

Copy link
Copy Markdown
Contributor Author

Yep, I did compare, to me it looks good

@manzoorwanijk manzoorwanijk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks fine to me. Thank you for doing this.

@gmjuhasz
gmjuhasz merged commit 92c5ba6 into trunk Jul 21, 2026
98 checks passed
@gmjuhasz
gmjuhasz deleted the gmjuhasz/audit-seo-antipatterns branch July 21, 2026 08:14
@github-actions github-actions Bot removed [Status] In Progress [Status] Needs Review This PR is ready for review. labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] Seo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants