-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bug: React Carousel ruins the scroll position on every state change #1631
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
e |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
e |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
React Carousel bug
It seems to me that on every state change, onInit is triggered, and then the scroll position jumps to somewhere on the page
The scroll remains if you click the change state button when u are at the very bottom of the page or the very top of the page.
The useEffect correctly runs once.
Maybe something to do with prevScrollPosition in detail instance.
Steps to reproduce
when I click the button it hijacks my scroll position and this makes using other states impossible
https://codesandbox.io/p/sandbox/lightbox-carousel-bug-rj3tnq
App.tsx
Carousel.tsx
styles.css
Environment
Additional context
Unrelated side note - there is also the bug which the carousel flashes open and closes fullscreen when the page mounts. I have temporary work around for it (not in the sandbox) but its also bad
The text was updated successfully, but these errors were encountered: