`backdrop-blur-` does not work on webkit browsers (ie safari)
What version of Tailwind CSS are you using?
v3.4.4
What build tool (or framework if it abstracts the build tool) are you using?
Next v14.2.2
PostCSS v8
What version of Node.js are you using?
Node v20.11.1
Bun v1.1.8
What browser are you using?
Safari [macOS/iOS] (does NOT work as expected) v17.5
Brave [Windows] (works as expected) v1.67.116
Arc [macOS] (works as expected) v1.47.1
Edge [Windows] (works as expected) v126.0.2592.56
What operating system are you using?
macOS 14.5 Windows 11 23H2
Reproduction URL
https://play.tailwindcss.com/s0uKhW1RIh
Describe your issue
The backdrop-blur- classes do not add the -webkit- style, so Safari and other webkit browsers aren't being styled with a backdrop blur.
In this mean while, ot solve this I manually added each of the classes to my global css file
.backdrop-blur-3xl {
--tw-backdrop-blur: blur(64px);
-webkit-backdrop-filter: var(--tw-backdrop-blur);
backdrop-filter: var(--tw-backdrop-blur);
}
...etc
Hey! In your own projects this is handled by autoprefixer which uses your browserslist configuration to determine supported browsers and what prefixes need to be applied. As for Tailwind Play, there was a configuration issue (also related to autoprefixer) that caused this but I've fixed it and your Play now works and shows the blur correctly!
Thanks for letting us know 👍
As for Tailwind Play, there was a configuration issue (also related to autoprefixer) that caused this but I've fixed it and your Play now works and shows the blur correctly!
@thecrypticace what was that configuration issue?
I can still see this issue on webkit even after using autoprefixer and browserslist. Also there is a strange thing, when I manually put the css variable value from inspector(copy) to inspector(paste), then it works:
https://github.com/user-attachments/assets/3cb54c14-843a-49d8-9a00-85d9961a502b
@Muhammed-Rahif What browser is that? It's working here.
It's a tauri instance: https://tauri.app/start/
FYI: Tauri uses WRY (WebKitGTK for Linux, WebKit for MacOS, Webview2 for Windows). And I am using tauri on linux. Source: https://github.com/Elanis/web-to-desktop-framework-comparison#major-characteristics
I wonder if it's a much older webkit version where variable fallbacks worked a bit differently. 🤔
I'll see if I can spin up a linux box and give it a test (may not happen today but hopefully this week)
any update?
Why is this issue closed? I can reproduce
I have the exact same issue on Orion Browser version 0.99.130.2 on macOS which uses WebKit 621.1.2.111.4. I can reproduce the steps in the video by putting the value manually in the web inspector.
I do not however have the issue a on the iOS version of Orion Browser version 1.3.15 which uses WebKit 8619.2.8.10.7. I checked on macOS Safari (version 18.2) which uses a slightly older WebKit (620.1.16) and do not have the issue either.
Using Safari Desktop Version 18.2 (19620.1.16.111.6, 19620):
Very odd: var does not work with -webkit-backdrop-filter. Even though Safari tells me that the variable has a value, it doesn't apply any blur effect on the element:
Using var inside blur also does not work:
I can test and find that the variable works for border-width but not for -webkit-backdrop-filter:
This is the only way to get the blur working in Safari:
If I directly apply the actual value, then the blur effect works and is applied on the element.
This would mean the Tailwind generated CSS here does not work in Safari:
.backdrop-blur-sm {
--tw-backdrop-blur: blur(var(--blur-sm));
-webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
}
We have to override it and insert all the actual values for Safari:
-webkit-backdrop-filter: blur(8px) brightness( ... etc. ) etc.;
Please re-open or tell us if we should open a new issue.
Looks like it works to me (with and without the @property): https://play.tailwindcss.com/xuWb6hIqXV?file=css
@thecrypticace I can't ascertain if you're testing on Safari, and which version.
Safari 18.3 — this worked in 18.2 and before as well. This is why I also gave a link to to the Play.
I updated to Safari Desktop Version 18.3 (19620.2.4.111.8, 19620) but still:
Variable does not work:
This version also does not work, even if it does the fallback:
--my-var2: 20px; /* disable to do the fallback */
-webkit-backdrop-filter: blur(var(--my-var2, 5px));
Only inline fixed value works:
Conclusion
It looks like Safari doesn't support CSS variables in -webkit-backdrop-filter for some odd reason.
What OS are you running? and hardware? (Also are you running this in a VM?)
It absolutely does support CSS variables so the fact that it's not working for you is a definite bug in WebKit.
@thecrypticace Apple M1 Pro, macOS Sonoma 14.7.2 (23H311), MacBook Pro.
There's no VM.
Edit: Please don't tell me this will only work in Sequoia. I'm not upgrading yet because I want to stay in a stable version of macOS. Besides, Safari itself is separate from macOS.
This looks like an eerily similar problem but for a different property: http://aaronpinero.net/learned/posts/2024/04/2024-04-17/
Any thoughts on this?