Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ::selection to root color vars #2437

Merged
merged 3 commits into from May 16, 2023
Merged

Add ::selection to root color vars #2437

merged 3 commits into from May 16, 2023

Conversation

langermank
Copy link
Contributor

@langermank langermank commented May 2, 2023

Fixes: https://github.com/github/github/issues/264779

What are you trying to accomplish?

We're getting several bug reports in Chrome related to color vars and ::selection due to a Chromium experiment.

What approach did you choose and why?

Based on this article, maybe adding ::selection will fix the problem?

What should reviewers focus on?

Will this break the world?

Can these changes ship as is?

  • Yes, this PR does not depend on additional changes. 馃殺

@langermank langermank requested a review from a team as a code owner May 2, 2023 17:51
@changeset-bot
Copy link

changeset-bot bot commented May 2, 2023

馃 Changeset detected

Latest commit: cea2c16

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/css Patch

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

@langermank langermank temporarily deployed to github-pages May 2, 2023 17:58 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview May 2, 2023 17:58 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview May 2, 2023 18:00 Inactive
@langermank langermank merged commit 616c893 into main May 16, 2023
14 checks passed
@langermank langermank deleted the selection-root-fix branch May 16, 2023 19:19
@primer-css primer-css mentioned this pull request May 16, 2023
@keithamus
Copy link
Member

@langermank This PR will need reverting because the introduction of ::selection blows the whole selector away. The ::selection style needs to be standalone it seems. In particular, the following:

@include color-mode("light") {
  p {
    color: green
  }
}

gets compiled into

:root p,
::selection p {
  color: green
}

which it seems is discarded. Here's a minimal repro to demonstrate that the selector is discarded:

https://codepen.io/keithamus/pen/mdQrGMo

Refs https://github.com/github/issues/issues/6741, https://github.com/orgs/community/discussions/58723#discussioncomment-6250327

keithamus added a commit that referenced this pull request Jun 22, 2023
keithamus added a commit that referenced this pull request Jun 22, 2023
* Revert "Add `::selection` to root color vars (#2437)"

This reverts commit 616c893.

* changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants