SEO: migrate dashboard styles to CSS Modules - #50617
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis 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. 🤷 |
There was a problem hiding this comment.
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. |
Sorry, did already in #50634 and also added folder to the linter rule about thoes fallbacks. :-) |
| .title { | ||
| margin: 0; | ||
| font-size: 20px; | ||
| font-weight: 600; | ||
| } |
There was a problem hiding this comment.
This can likely just be <Text> and no need styles at all.
| // 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; | ||
| } |
There was a problem hiding this comment.
This can just use VisuallyHidden component from @wordpress/ui.
|
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 |
…ntipatterns # Conflicts: # projects/packages/seo/_inc/screens/content/style.scss # projects/packages/seo/_inc/screens/overview/style.module.scss
|
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 :) |
|
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. |
|
Yep, I did compare, to me it looks good |
manzoorwanijk
left a comment
There was a problem hiding this comment.
Looks fine to me. Thank you for doing this.
Proposed changes
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm exec eslint projects/packages/seo.pnpm exec stylelint 'projects/packages/seo/_inc/**/*.{css,scss,sass}'.pnpm --filter @automattic/jetpack-seo run typecheck.pnpm --filter @automattic/jetpack-seo run test --runInBand.jp build packages/seo --deps.We also moved to using UI components instead of bare css where possible so sanity test UI:
Test these areas in Jetpack → SEO:
Overview
Content → open a post inspector
Settings → Search & social previews