filamentgroup / fixed-sticky

DEPRECATED: A position: sticky polyfill that works with filamentgroup/fixed-fixed for a safer position:fixed fallback.
MIT License
1.49k stars 153 forks source link

z-index not respected in polyfill #26

Open dlerman opened 10 years ago

dlerman commented 10 years ago

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?

zachleat commented 10 years ago

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!

anselmh commented 8 years ago

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.

fstoerkle commented 8 years ago

Hi @zachleat, do you have something planned here?

Would you accept a PR here?