There’s this thing that you need to know about when dealing with z-index and trying to get some elements to be on top of other elements: stacking contexts . If you’ve got an element within a stacking context that is itself lower than another element that you’re trying to get on top of, well, you’re hosed.
And yet, these days, there is something of an escape hatch. Stephanie Eckles introduces our hero :
A modern web feature is the “ top layer ,” which is guaranteed to be the top-most layer above any other stacking context. It spans the entire viewport, although elements existing in the top layer may have smaller visible dimensions.
If you can get an element onto the top layer, it just will be on top of everything else. Stacking contexts be damn. Open dialogs and popovers will be on the top layer automatically.
And yet.
This combination of dialog and popover can potentially lead to other stacking problems where a visual popover might still be rendered inaccessible by a dialog.…