robbestad/react-stickydiv

Div 'skips' with non-zero margin

Opened this issue · 1 comments

It seems that the sticky state does not kick in until the top-most element's border hits the edge of the screen.

That seems to make sense, except that if the first element inside the sticky div has non-zero margin, then it 'jumps' when the stickiness begins. I.e.:

  1. The element's margin does not trigger the sticky state
  2. The sticky state is triggered once the element's border hits the edge
  3. The element then gets wrapped in a fixed position div
  4. It's margin then causes it to be bumped down into the page, hence the 'jump' as it becomes sticky.

I think the fix needs to happen in your dom-find package, but I'm reporting the bug here because this is where the bug exhibits itself.

Thanks for report, I'm looking into it now