Coder Social home page Coder Social logo

Comments (1)

abstiles avatar abstiles commented on June 8, 2024

Wow, okay, this one took me a while to figure out. Turns out that -webkit-filter creates a stacking context. Who knew? Anyway, I use -webkit-filter to uninvert images (you'll notice that in "Invert All Images" mode, the captioned text works perfectly). The problem is that the caption divs only appear because they've been positioned absolutely and given an opacity. This creates a stacking context and ensures that they'll appear above sibling elements that don't create their own stacking contexts. Normally the img tag on that page does not create a stacking context, so the captions appear above it, and everyone is happy. When I uninvert the image in order to display it normally, I apply a -webkit-filter to it, creating a stacking context. Now there are problems because, z-indexes being equal, the image now stacks higher than the captions. The funny thing about this page in particular is that triggering the "popover text" by hovering over the captions adds a positive z-index to them, which causes them to once again appear above the image. After that happens Deluminate doesn't screw things up.

Whew! I created a minimal jsfiddle to demonstrate the problem. If you uncomment the position: absolute line and re-run the jsfiddle, you'll see the blue box pop in front of the red one. This imitates the way the image covers up its own captions when it gets uninverted.

I have bad news, though: this behavior is specified by the standards. This is not a Chrome bug; it's actually how this is supposed to work (assuming that CSS filters are intended to create a stacking context, which seems as likely as anything else). Even worse, I can't imagine a way to programmatically detect and work around this situation in the general case. Nor is there a way to avoid using -webkit-filter to uninvert images as far as I know, or prevent -webkit-filter from creating a stacking context.

As far as I can tell, no fix for this can exist. Your best bet is to use custom CSS to style this site if the captions are really important to you.

from deluminate.

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.