Add option explicitAmpersand on @emotion/cache to handle :is and :where, etc#3210
Add option explicitAmpersand on @emotion/cache to handle :is and :where, etc#3210thomaslindstrom wants to merge 5 commits intoemotion-js:mainfrom
explicitAmpersand on @emotion/cache to handle :is and :where, etc#3210Conversation
🦋 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/cacheexplicitAmpersand(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
:whereand: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
explicitAmpersandset tofalse(the current behavior) will output:But with
explicitAmpersandset 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/cacheexplicitAmpersand.Checklist: