fixed-sticky icon indicating copy to clipboard operation
fixed-sticky copied to clipboard

z-index not respected in polyfill

Open dlerman opened this issue 11 years ago • 3 comments

Thanks for this great project!

Quick question: with native sticky positioning, it looks like z-index is respected even when the element is unstuck. Mozilla docs say "Sticky positioning is a hybrid of relative and fixed positioning.", both of which respect z-order.

However, in the polyfill implementation, it toggles between static and fixed positioning (rather than relative and fixed), and the static positioning ignores z-index.

So, if you have a sticky element positioned on top of a background element, the native version will show it correctly, but the polyfill will only show it when stuck.

Is there a reason for using static in the polyfill rather than relative?

dlerman avatar Jun 25 '14 15:06 dlerman

Not really, no, other than we’d have to add a bit more CSS to reset top, bottom, left, and right values. I’d be in favor of changing this!

zachleat avatar Jul 01 '14 16:07 zachleat

Using static for sticky is a bug. It should as per spec instead be relative and it caused a couple of problems in my recent testing.

anselmh avatar Feb 18 '16 08:02 anselmh

Hi @zachleat, do you have something planned here?

Would you accept a PR here?

fstoerkle avatar Sep 06 '16 14:09 fstoerkle