Bug 168725

Summary: position: sticky shouldn't create a stacking context
Product: WebKit Reporter: Robert Flack <flackr>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, cigitia, emilio, simon.fraser, zalan
Priority: P2    
Version: Safari 9   
Hardware: Unspecified   
OS: Unspecified   

Description Robert Flack 2017-02-22 07:51:56 PST
As far as I can tell from reading https://drafts.csswg.org/css2/visuren.html#z-index only position fixed implicitly creates a stacking context.

Loading http://output.jsbin.com/yucorey shows an example page which demonstrates that currently sticky is creating a stacking context (i.e. the z-index 2 descendant is stacked below the z-index 1 sibling.
Comment 1 Simon Fraser (smfr) 2017-02-22 08:34:35 PST
I think it's better to match position:fixed here, since sticky has fixed-like behavior part of the time.

https://drafts.csswg.org/css-position-3/#position-property needs to be updated to say this.
Comment 2 Simon Fraser (smfr) 2017-02-22 08:36:52 PST
https://github.com/w3c/csswg-drafts/issues/1053
Comment 3 Emilio Cobos Álvarez (:emilio) 2022-07-14 15:16:24 PDT
@smfr: Did safari regress something here?

  data:text/html,<meta charset=utf8><h1 style="position: sticky; top: 0;background-color:tomato; text-align: center;">Hello</h1><main style="height: 200vh;"><button>Plain, under</button><button style="opacity: 0.6;">Translucid, overlaps</button></main>

Seems to not behave the same as:

  data:text/html,<meta charset=utf8><h1 style="position: fixed; width: 100% top: 0;background-color:tomato; text-align: center;">Hello</h1><main style="height: 200vh;"><button>Plain, under</button><button style="opacity: 0.6;">Translucid, overlaps</button></main>

in Safari, but it does in Gecko and Blink.
Comment 4 Simon Fraser (smfr) 2022-07-14 18:56:32 PDT
Looks like we have an overlap-testing bug where "Translucid" fails to z-order on top o the sticky if you scroll (it gets fixed if you resize the window when it's on top).