You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you create dark and anything variants through plugins like this:
plugins: [plugin(function({ addVariant, e }){// Will get (potentially unwanted) stacking behavioraddVariant('dark',({ modifySelectors, separator })=>{modifySelectors(({ className })=>{return`.custom-dark .${e(`dark${separator}${className}`)}`})});// Will NOT get stacking behavioraddVariant('anything',({ modifySelectors, separator })=>{modifySelectors(({ className })=>{return`.anything .${e(`anything${separator}${className}`)}`})});}),],
Notice that dark is stacking with the other variants, and because of this it's been pushed to the end of the CSS. This is despite being listed first in the list of variants for textColor. The only reason dark is doing this but anything is not is because of the name dark, which is taking on the stacking behavior of the upcoming (experimental) darkModeVariant.
The CSS I would expect (same as 1.7 and probably many versions earlier):
I think this should be classified as a bug because what was supposed to be contained under the experimental darkModeVariant flag has leaked out and become a breaking change.
Describe the problem:
If you create
dark
andanything
variants through plugins like this:and have a variants list like this:
The current (Tailwind CSS 1.8.9) resulting CSS is:
Notice that
dark
is stacking with the other variants, and because of this it's been pushed to the end of the CSS. This is despite being listed first in the list ofvariants
fortextColor
. The only reasondark
is doing this butanything
is not is because of the namedark
, which is taking on the stacking behavior of the upcoming (experimental)darkModeVariant
.The CSS I would expect (same as 1.7 and probably many versions earlier):
I think this should be classified as a bug because what was supposed to be contained under the experimental
darkModeVariant
flag has leaked out and become a breaking change.Link to a minimal reproduction:
See the
tailwindcss-dark-variant-repro
repository I've created here. The README restates some of the above and includes my possible diagnosis / solution (which are omitted from this issue because it won't fit the issue template).Edit: Pull request #2380 will solve this.
🙏 Thank you.
The text was updated successfully, but these errors were encountered: