Skip to content

fix: scope css to sui- class prefix - #3304

Open
laurenashpole wants to merge 5 commits into
v5-alphafrom
fix/global-css-scoping
Open

laurenashpole wants to merge 5 commits into
v5-alphafrom
fix/global-css-scoping

Conversation

@laurenashpole

@laurenashpole laurenashpole commented Nov 6, 2026 •

Copy link
Copy Markdown

Description

This PR updates our reset.css file to scope all selectors to classes beginning with .sui-. It also updates the Storybook styling for the light/dark plugin, makes sure text is wrapped in the Text wrapper in all stories, and turns off lightningcss in Storybook (this was causing problems in Chromatic Storybook builds).

What to review

Make sure the CSS makes changes make sense.

Testing

I tested this locally making sure to look at:

  • Every Storybook story in dark mode
  • Parent and child input examples
  • Code blocks

Note

Medium Risk
Scoped resets change how non-sui- host pages behave (no global * reset), which can affect embedded UI and third-party markup; Storybook/Chromatic CSS pipeline changes need visual verification.

Overview
Scopes the global CSS reset so box model, margin/padding zeroing, form control, media, table, code, and reduced-motion rules apply only inside sui- class trees instead of the whole document; body background is no longer set in the reset.

Storybook picks up page background via light-dark() on html body, applies color-scheme to descendants in light/dark mode, adds lightningcss with viteFinal excluding Features.LightDark (to fix Chromatic builds), and updates stories to wrap copy in Text so typography/reset apply—interaction tests now assert on parentElement for data-ui, tone classes, and tab panel visibility/focus.

Reviewed by Cursor Bugbot for commit 77dfc9c. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
sanity-ui-storybook Ignored Ignored Nov 10, 2026 10:07pm UTC
sanity-ui-workshop Ignored Ignored Nov 10, 2026 10:07pm UTC
ui-docs Ignored Ignored Nov 10, 2026 10:07pm UTC
ui-studio Ignored Ignored Nov 10, 2026 10:07pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 77dfc9c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@laurenashpole
laurenashpole marked this pull request as ready for review November 6, 2026 19:47

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d4f13bd. Configure here.

Comment thread packages/ui/src/css/global/reset.css Resolved
border: 0 solid transparent;
}

:root {

@laurenashpole laurenashpole Nov 10, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Moved this back out of :where([class*="sui-"]):not(:where([class*="sui-"]) :where([class*="sui-"])) because the robot is right that would cause problems if an app is toggling light/dark mode by applying classes to body.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant