Replies: 1 comment 1 reply
-
The I think the unexpected behavior is indeed with pseudo-elements, where browsers don't support nesting inside of them (see #16582 (comment) for a different manifestation of a similar problem) The .together {
&:focus-visible::before, &:hover::before {
background-color: var(--hover, var(--fg));
@supports (color: color-mix(in lab, red, red)) {
background-color: color-mix(in srgb, var(--hover, var(--fg)) 50%, var(--bg));
}
}
} I think Tailwind might need to fix this, since we as authors cannot manipulate where the .together {
&:focus-visible::before, &:hover::before {
background-color: var(--hover, var(--fg));
}
@supports (color: color-mix(in lab, red, red)) {
&:focus-visible::before, &:hover::before {
background-color: color-mix(in srgb, var(--hover, var(--fg)) 50%, var(--bg));
}
}
} Or .together {
&:focus-visible, &:hover {
&::before {
background-color: var(--hover, var(--fg));
}
@supports (color: color-mix(in lab, red, red)) {
&::before {
background-color: color-mix(in srgb, var(--hover, var(--fg)) 50%, var(--bg));
}
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Note
edit: I believe this issue actually originates in Lightning CSS (parcel-bundler/lightningcss#975) and the Tailwind side of things is okay.
Sample app using Next.js.
Since
@tailwindcss/postcss@4.1.2
(most likely commit60b0da9
), the CSS functioncolor-mix
resolves unexpectedly when:&::before, &::after {}
, or&:hover::before, &:focus-visible::before {}
For example (excerpt from src/app/globals.css):
Other notes:
&:focus-visible, &:hover {}
@tailwindcss/postcss@4.1.2
and later - doing the same thing on4.1.1
works as expected.npm run build && npm run start
- at least on Next.js.npx @tailwindcss/cli -i ./src/app/globals.css -o ./output.css
- it only seems to happen when postcss is applied.Is there anything else I should try before reporting this as a bug?
Beta Was this translation helpful? Give feedback.
All reactions