-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add option explicitAmpersand
on @emotion/cache to handle :is and :where, etc
#3210
base: main
Are you sure you want to change the base?
Add option explicitAmpersand
on @emotion/cache to handle :is and :where, etc
#3210
Conversation
🦋 Changeset detectedLatest commit: 9d502cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
@emmatown I think we should do something about it. In the next major version, we should drop the |
Unless I'm misunderstanding something about specificity, there's a very simple workaround to this of using I still agree with changing the behaviour though, pretty much just since it's the behaviour in the standard CSS nesting now. I'm not sure about the name of the option though since there are still implicit ampersands, they're just inserted in a different place now.
By |
Both. Currently we "patch" some selectors by inserting |
Sounds good then |
Based on the following issue: #2836
This adds an opt-in option on
@emotion/cache
explicitAmpersand
(unsure about name) that disables the automatic prefixing of pseudo classes in the CSS.What:
I identified an issue in my own CSS with newer pseudo classes like
:where
and:is
, where Emotion automatically prefixed those classes with the current class name (with no spaces). This was not the expected behavior, and there was no way for me to opt-out of this behavior.Consider:
where the output with the
explicitAmpersand
set tofalse
(the current behavior) will output:But with
explicitAmpersand
set totrue
(new behavior):Why:
The current behavior of automatic prefixing of the parent class name is confusing and breaks the behavior of new psuedo classes.
How:
Added an opt-in option on
@emotion/cache
explicitAmpersand
.Checklist: