Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky element is mispositioned when StickyContainer is within a position: relative container #271

Open
1 of 3 tasks
hepiyellow opened this issue Feb 10, 2019 · 1 comment

Comments

@hepiyellow
Copy link

hepiyellow commented Feb 10, 2019

I'm submitting a ...

  • bug report
  • feature request
  • support request

If you're reporting a bug, please provide a minimal demonstration of the problem

Bug Demo

What is the current behavior?

When the <StickyContainer/> has an ancestor with position: relative, the using <Sticky relative/> causes the Sticky element to jump to viewport's top when sticked.

What is the expected or desired behavior?

To stay in <StickyContainer/>.

Why do you want this? What use case do you have?

My Page has an App wrapper (not in my control), and renders my page in a container with position: relative.

What is your environment?

  • Version:
react-sticky
└── 6.0.3
  • Browser: Chrome Version 71.0.3578.9

Is there anything else I should know?

@hepiyellow hepiyellow changed the title BUG(?): relative mode makes <Sticky/> jump to body's top BUG(?): Case where <StickyContainer/> is wrapper in a positioned container (position: relative) Feb 10, 2019
@vcarl
Copy link
Contributor

vcarl commented Feb 11, 2019

Ah I see, yeah that does appear to be a bug. I forked your demo to make it clearer what's happening. https://codesandbox.io/s/wq621mz9j7

@vcarl vcarl added the bug label Feb 11, 2019
@vcarl vcarl changed the title BUG(?): Case where <StickyContainer/> is wrapper in a positioned container (position: relative) Sticky element is mispositioned when StickyContainer is within a position: relative container Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants