Description
What version of Tailwind CSS are you using?
Not sure what version sites are using, but I suspect less than a year old.
What build tool (or framework if it abstracts the build tool) are you using?
Don't know
What version of Node.js are you using?
Don't know
What browser are you using?
Chrome and Edge
What operating system are you using?
All
Reproduction URL
See https://issues.chromium.org/issues/378754060 for numerous reproductions. From The Verge:
.selection\:bg-franklin-20::selection {
--tw-bg-opacity: 1;
background-color: rgb(216 255 246/var(--tw-bg-opacity));
}
All selection is blank in Chrome 131 and later on The Verge, Bloomberg news, ...
Describe your issue
Chrome 131 and browsers using Chromium enable CSS Highlight Inheritance for ::selection. In this model custom properties for ::selection and other highlight pseudos are taken from the originating element, and not the pseudo itself. All custom properties defined on highlight pseudos are ignored. But Tailwind defines a custom property for opacity on every use of a color, including ::selection colors. There is no practical use for this because the variable is redefined all over the place and any given usage inside ::selection applies only within that ::selection block (with the old behavior).
See https://developer.chrome.com/blog/selection-styling and https://blogs.igalia.com/schenney/css-custom-properties-in-highlight-pseudos/
I might try to figure out how to fix this and put up a PR for you.