Giter VIP home page Giter VIP logo

Comments (9)

Josh-Cena avatar Josh-Cena commented on August 20, 2024

Hi, this feature is actually not supported.

document.createElement("div").style.backdropFilter; // returns undefined in Safari

You can try a minimal example:

<div style="background-image: url('https://interactive-examples.mdn.mozilla.net/media/examples/balloon.jpg'); width: 250px; height: 300px; display: flex; justify-content: center; flex-direction: column;">
  <div style="backdrop-filter: blur(10px); text-align: center;">
    <p>Hello</p>
  </div>
</div>

This doesn't work in my Safari 16.3. The reason why the live example below works is because it uses the -webkit-backdrop-filter: blur(10px); fallback, which is mentioned in the compat table:

Implemented with the vendor prefix: -webkit-

from bob.

electrovir avatar electrovir commented on August 20, 2024

Does that not count as support? It just seems strange to me that the demo up top would show an error like that when it's trivial to make it work (just add the prefix).

from bob.

Josh-Cena avatar Josh-Cena commented on August 20, 2024

Well, the demo demonstrates the un-prefixed API. It could try to automatically "polyfill" with prefixes, but that would be hard to generalize since you can edit the CSS however you wish. In that case this would be re-purposed as an enhancement request.

from bob.

NiedziolkaMichal avatar NiedziolkaMichal commented on August 20, 2024

We could apply autoprefixer for CSS properties used in the initial example and make it work even if the user changes a property value. Making it work for all possible properties would probably significantly increase bundle size, but I think users very rarely edit the example to a completely different property, so it's not really needed.

from bob.

Josh-Cena avatar Josh-Cena commented on August 20, 2024

I reckon the bundle size won't be huge (especially since it can be lazy-loaded), but wondering whether it would create more confusions (why something is allegedly not available but still working, etc.)

from bob.

NiedziolkaMichal avatar NiedziolkaMichal commented on August 20, 2024

@Josh-Cena 256kb minified. I guess for CSS properties that were entered by the user in a "choice box", we could just apply all vendor prefixes without even checking if they exist, but it wouldn't work for rare cases in which property is implemented under a bit different property name.

from bob.

wbamberg avatar wbamberg commented on August 20, 2024

FWIW we use prefixes manually in examples sometimes: https://developer.mozilla.org/en-US/docs/web/css/box-decoration-break.

I think applying but hiding prefixes (if that is the suggestion) would be very confusing for people.

from bob.

NiedziolkaMichal avatar NiedziolkaMichal commented on August 20, 2024

@wbamberg How about if the editor would show either prefixed property or unprefixed property, based on what it supports?

In the backdrop-filter example, Chrome would show:
image

and Safari would show:
image

from bob.

wbamberg avatar wbamberg commented on August 20, 2024

I think this would be fine. Main thing is that what people see in the editor should be what's actually getting used :).

from bob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.