Skip to content
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

[v4] Chrome ~v103 chokes on comma in .bg-gradient-* Utility #13659

Closed
bryanveloso opened this issue May 8, 2024 · 2 comments
Closed

[v4] Chrome ~v103 chokes on comma in .bg-gradient-* Utility #13659

bryanveloso opened this issue May 8, 2024 · 2 comments

Comments

@bryanveloso
Copy link

bryanveloso commented May 8, 2024

Tailwind Version: next using Vite plugin

I've been using Tailwind to design overlays in OBS Studio for years now. Recently decided to take the jump and try next. Ran into an odd problem in which none of my defined bg-gradient-* styles would show up in OBS' browser source.

"Offending" line: https://github.com/tailwindlabs/tailwindcss/blame/5e737d858755a7149e17b5f3feaeb0d42865354d/packages/tailwindcss/src/utilities.ts#L2490

Taking the example code from the documentation:

<div class="h-14 bg-gradient-to-r from-cyan-500 to-blue-500"></div>

Inspecting .bg-gradient-to-r in Chrome 124:

.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}

Inspecting .bg-gradient-to-r in Chromium 103.0.5060.134 (OBS Studio's version):

.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops,));
}

The comma persists in the older version of Chromium, which breaks the style. Removing the comma manually fixed it. I don't file issues all that often, so I'm not sure if this is an actual bug with tailwind@next, or if I should be heading over to OBS to try to get them to upgrade their Chromium version.

Either way, please let me know if anything further is needed!

@ekwoka
Copy link

ekwoka commented May 18, 2024

This is an issue with the older browsers. I believe tailwind before would put a comment in there like /*tw*/ as it was a known issue that older browsers would have issues with a comma and no space afterwards before the ) but minifiers would always remove the space.

if you try

.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops, ));
}

you should see that that works as well.

@thecrypticace
Copy link
Contributor

The trailing comma is valid syntax — it means there's an empty fallback value for the variable. Similar to if you'd defined a variable like --my-var:; (also valid). As @ekwoka mentioned older browsers didn't handle this correctly but they do now. Given that Chromium 103 is nearly 2 years old I'd suggest that OBS needs to update their Chromium version. tbh I'm a bit surprised it's that far out of date 🤷‍♂️.

All in all — not a Tailwind bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants