https://codepen.io/sontek/pen/OOMmvN
The popper is below both the content and the absolute positioned footer. How can I make sure it is above them?
The popper to be above the absolute positioned footer.
The popper is below it.
https://codepen.io/FezVrasta/pen/QOyvVg ?
The thing is, any z-index higher than 3 denotes a lack of understanding of how it works.
@FezVrasta Sorry, we have z-index higher than 3 because we use an opensource react component that has set their z-index higher than that and we have to pop above it.
Your pen gets it above the content but not the absolute positioned footer, which is my problem. Shrink your window so the gray box is closer to the popper
isolation: isolate is your best friend.
z-index is thought to be used in "stack contexts", you just create small stacks with few elements (and then, few layers)
@FezVrasta Yeah, but isolation isn't supported in any IE (even modern ones), correct?
There are plenty of alternatives:
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
So what would be the best way to handle a thing like what I'm doing here? In the codepen you posted its just z-index: 1 and z-index: 2 but the popper doesn't go above the absolute positioned element that has the lower z-index.
You want to have a stacking context for the page layout, and then on top of it you put a other elements (like the popper) that with just a z-index: 1 will stay above the rest
So basically popper.js eschews the problem of browsers missing a global z-index (*), which is the main reason for positioning popups in js in the first place. I kept wondering "how does popper keep the popups on top of everything if it doesn't move them to the root element, since there might be implicit z-stacks created along the path?" Now I know: it doesn't.
(*) Let's face it, stacking contexts are just an abstraction leak of the graphics model. Saying "create shallow context stacks" is not helpful as there's plenty of legit use cases that create implicit z-stacks.
Most helpful comment
So basically popper.js eschews the problem of browsers missing a global z-index (*), which is the main reason for positioning popups in js in the first place. I kept wondering "how does popper keep the popups on top of everything if it doesn't move them to the root element, since there might be implicit z-stacks created along the path?" Now I know: it doesn't.
(*) Let's face it, stacking contexts are just an abstraction leak of the graphics model. Saying "create shallow context stacks" is not helpful as there's plenty of legit use cases that create implicit z-stacks.