-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Focus ring opacity on text input not working with arbitrary value #7521
Comments
Hey! Classes can't have spaces, remove the spaces and it works: https://play.tailwindcss.com/BnVCX0a31C The browser delimits the
...the browser thinks you have added three classes:
More here: https://tailwindcss.com/docs/adding-custom-styles#handling-whitespace |
Ohh sorry, actually my mistake. You're right it works. But I was using css vars and that's what's not working, I created new tailplay - https://play.tailwindcss.com/ClyzxS1tM0 This works:
This doesn't work:
|
Yeah not possible to use the opacity utilities alongside CSS variables like that, there's just literally no way to do it with CSS because setting the opacity means changing the actual color value. Some docs related to that: https://tailwindcss.com/docs/customizing-colors#using-css-variables Here's a demo where it does work, by only setting the color channels in the variable instead of the full color so that the final color can be composed alongside the opacity variable: |
Oh thank you very much that is very interesting! |
What version of Tailwind CSS are you using?
"tailwindcss": "^3.0.18",
What build tool (or framework if it abstracts the build tool) are you using?
"next": "12.0.9",
What version of Node.js are you using?
v12.19.0
What browser are you using?
All
What operating system are you using?
macOS
Reproduction URL
https://play.tailwindcss.com/Tv8lkLkkLn
Describe your issue
A custom ring to text input with arbritrary value works fine like this:
However it's opacity cannot be reduced with
focus:ring-opacity-30
.Trying it, causes the arbitrary value to be ignored, and the default ring from
focus:ring
shows.Here is a great explantion by JHeth from Stackoverflow:
Tailwind arbitrary values don't work with rgb or rgba values, this issue on Github exposed it and this pull was supposed to fix it but you can still see the behavior on Tailwind Play quite clearly, there is no generated class when using arbitrary rgb values (if there were, a tiny color swatch would appear next to the class).
Major thanks to JHeth from Stackoverflow for helping identify this bug and creating the Tailplay - https://stackoverflow.com/a/71168939/1828637
The text was updated successfully, but these errors were encountered: