varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.4k stars 63 forks source link

backdrop-filter blur not working in Safari #491

Open sebastinto opened 3 months ago

sebastinto commented 3 months ago

Using backdropFilter() with a blur() CSSFilter is not working in Safari.

This is reproducible by navigating to https://bitspittle.dev/blog/2022/kotlin-site in Safari and observing that the header backdrop is translucent instead of blurred.

Safari

Screenshot 2024-03-31 at 1 42 28 PM

Chrome

Screenshot 2024-03-31 at 1 43 48 PM



As a workaround in my project I'm using this which seems to be working fine:

fun Modifier.backdropFilter(vararg filters: CSSFilter) = styleModifier {
    if (filters.isNotEmpty()) {
        listOf("backdrop-filter", "-webkit-backdrop-filter").forEach {
            property(it, filters.joinToString(" "))
        }
    }
}

but since I'm not well-versed in web development, I'm unsure whether this is a proper fix.

bitspittle commented 2 months ago

BTW meant to thank you for filing this. I'm also glad you found and shared a workaround. I will look into updating the code in Kobweb.

I was trying to avoid the hacky "-webkit-" prefixes that seem to pervade so many projects, but more because I thought that was an indication that the CSS property was still experimental. However, backdrop-filter not working for Safari is kind of a big deal.

bitspittle commented 2 months ago

This should be fixed in 0.17.2 when it goes out (aiming for tomorrow, pending some local tests).