tailwindcss
tailwindcss copied to clipboard
Invalid CSS causes entire page to crash with STATUS_BREAKPOINT
What version of Tailwind CSS are you using?
v4.0.17
What build tool (or framework if it abstracts the build tool) are you using?
postcss 8.5.3, React 18.3.1, Vite 6.0.3
What version of Node.js are you using?
v22.0.0
What browser are you using?
Chrome, Vivaldi, WebView2 (Tauri app)
What operating system are you using?
Windows
Reproduction URL
https://play.tailwindcss.com/Et6k9kAgbw
Describe your issue
I'm working with Tauri, Vite, React, and tailwindcss (with postcss transformer defined in vite.config.js). One specific class with 3 modifiers (file:disabled:dark:bg-green-500) generates some invalid CSS which in turn crashes the entire page with STATUS_BREAKPOINT, this happened to me on both Chrome and WebView2 on Windows. I have @custom-variant dark (&:is(.dark *)); in my css file, I copied a similar variant from tailwind docs and used it in the playground with the same error occurring. Removing the custom variant generates @media modifiers instead and fixes the issue.
As a work-around, you could swap the order of the variants around so that file is last: https://play.tailwindcss.com/JWVIoFRqIL
I think this might be similar to #16582 (though with very different error symptoms), whereby it is invalid to have nested rules inside a pseudo-element rule.
Gonna have to file a browser bug for this one.
(also move the file variant to the front, the dark: selector appearing inside a pseudo element is invalid. Things like :active, :disabled, and :hover can potentially be valid depending on the browser)
Minimal repro is just this HTML:
<style>
.foo::file-selector-button {
&:disabled {
&:where(.bar *) {
background-color: red;
}
}
}
</style>
Notes for me when filing the bug:
- Moving :disabled to the top-level selector stops the crash
- Nesting is required for the crash to happen
- Removing
:disabledor:where(…)stops the crash &:where(.bar)does not crash but&:where(.bar *)does
I don't know what version of Chrome this got fixed in but it doesn't appear to crash any longer.