Skip to content

fix(s2): Remove all: revert-layer to avoid Safari bugs #7598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

devongovett
Copy link
Member

Due to several bugs in Safari's implementation of CSS cascade layers, we need to remove all: revert-layer from style macro generated CSS. This was added to prevent global CSS resets from overriding S2 styles. Unfortunately, these bugs prevent us from using this reliably. Instead we will recommend either removing global resets and applying the necessary styles locally, or manually adding your resets into a lower layer. See internal RSP v2 PR for this as well.

This also makes the UNSAFE_overrides layer we previously recommended unnecessary, because unlayered styles always win over layered ones.

You can see several places where I already had to deal with this, e.g. Storybook's default docs CSS winning over ours because it is unlayered. Luckily there is a way to disable that styling.

@rspbot
Copy link

rspbot commented Jan 10, 2025

Copy link
Member

@ktabors ktabors left a comment

Choose a reason for hiding this comment

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

where is sb-unstyled defined?

@devongovett
Copy link
Member Author

where is sb-unstyled defined?

it comes from storybook

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

Tested in Safari 18.2, all bugs I know about related to this appear resolved 🎉

/* This one should work */
background: hotpink;
}
.unsafe2 {
Copy link
Member

Choose a reason for hiding this comment

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

total nit pick, but should this be renamed to unsafe1? just to avoid confusion for people reading the docs that they are missing an example

Copy link
Member Author

Choose a reason for hiding this comment

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

it's just story example not docs so probably fine

@devongovett devongovett added this pull request to the merge queue Jan 16, 2025
Merged via the queue into main with commit 1286a65 Jan 16, 2025
30 checks passed
@devongovett devongovett deleted the revert-layer branch January 16, 2025 00:30
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.

4 participants