-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
cf7d240
to
a18f96b
Compare
darkMode: "class"
and add new darkMode: "selector"
optionclass
dark mode, add new selector
and variant
options for dark mode
…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 <4323180+adamwathan@users.noreply.github.com>
Nice |
The documentation (https://tailwindcss.com/docs/dark-mode) needs updated to include the
Update - this is my summary on the issue: The new From the examples linked in the issue #12633, it appears that the skeleton library pre-built CSS content for For the button example, without a |
Use darkMode selector strategy tailwindlabs/tailwindcss#12717 tailwindlabs/tailwindcss.com#1781
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 asdarkMode: "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:
darkMode: "class"
works the way it did in v3.3. This includes the difference in sorting.darkMode: "selector"
which uses the new:where()
behavior and sort order and as such makes this change opt-in.Fixes #12633