-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 ::selection
to color-mode-theme()
mixin
#2472
Conversation
🦋 Changeset detectedLatest commit: b90c40a 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 |
::selection
only to the color-mode-theme()
mixin::selection
to color-mode-theme()
mixin
} | ||
} | ||
} | ||
|
||
// This mixin wraps styles with light or dark mode selectors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is unrelated, but maybe good to document the color-mode()
mixin too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM 👍
AFAICT color-mode-theme
isn't used in dotcom so this should land safely.
Yeah, I haven't seen it being used outside of PCSS. Maybe in the next major version we could move it into color-modes/ to make it a bit more private and not part of the shared mixins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 👏
What are you trying to accomplish?
This fixes #2411 by adding
::selection
to thecolor-mode-theme()
mixin.What approach did you choose and why?
It's similar to #2437 that needed to be reverted again. But in this attempt, the
::selection
is only added to thecolor-mode-theme()
mixin. To make the::selection
work with CSS variables and all color modes, I had to add it everywhere@content
is used. It's a bit cumbersome, but not sure if there is a better approach? 🤔A usage example of
should output:
Before
After
Downside is that we can't use this mixin with a class anymore, like
since that would output
... ::selection .my-class
and as seen, make the selector invalid and the entire ruleset is discarded. 😩 I added a warning as a comment. At some point we hopefully can remove the&, &::selection {}
part again (once the spec/implementation changes). 🙏More infos:
What should reviewers focus on?
Note that this issue is currently only reproducible with Chrome's
chrome://flags/#enable-experimental-web-platform-features
enabled.I'll try to test this first with a canary version on dotcom to avoid any more surprises.
Can these changes ship as is?