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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore old behavior for class dark mode, add new selector and variant options for dark mode #12717

Merged
merged 24 commits into from
Jan 5, 2024

Conversation

thecrypticace
Copy link
Contributor

When we release v3.4 we changed darkMode: "class" to use :where and changed the sort order so it does not have a higher specificity. This also makes it act the same as darkMode: "media".

Some projects depended heavily on the higher selector specificity rather than using variants to explicitly handle light vs dark mode, dark mode vs hover styles, etc… This made this a pretty large breaking change.

This PR does two things:

  1. It reverts the change such that darkMode: "class" works the way it did in v3.3. This includes the difference in sorting.
  2. A new strategy has been added darkMode: "selector" which uses the new :where() behavior and sort order and as such makes this change opt-in.

Fixes #12633

@thecrypticace thecrypticace changed the title Restore old behavior for darkMode: "class" and add new darkMode: "selector" option Restore old behavior for class dark mode, add new selector and variant options for dark mode Jan 5, 2024
@thecrypticace thecrypticace merged commit fb1743b into master Jan 5, 2024
10 checks passed
@thecrypticace thecrypticace deleted the feat/dark-mode-variant branch January 5, 2024 19:39
thecrypticace added a commit that referenced this pull request Jan 5, 2024
…ariant` options for dark mode (#12717)

* Add dark mode variant option

* Tweak warning messages

* Add legacy dark mode option

* wip

* Use `class` for legacy behavior, `selector` for new behavior

* Add simplified failing apply/where test case

* Switch to `where` list, apply changes to `dir` variants

* Don’t let `:where`, `:is:`, or `:has` be attached to pseudo elements

* Updating tests...

* Finish updating tests

* Remove `variant` dark mode strategy

* Update types

* Update comments

* Update changelog

* Revert "Remove `variant` dark mode strategy"

This reverts commit 1852504.

* Add variant back to types

* wip

* Update comments

* Update tests

* Rename variable

* Update changelog

* Update changelog

* Update changelog

* Fix CS

---------

Co-authored-by: Adam Wathan <[email protected]>
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.

Dark mode broken in 3.4.0, last working 3.3.7
4 participants