You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
import{useState}from"react"importCarouselfrom"./Carousel"import"./styles.css"exportdefaultfunctionApp(){const[myState,setMyState]=useState(false)return(<div><divstyle={{height: "100vh"}}>long div 1</div><Carousel/><divstyle={{height: "100vh"}}>long div 2</div><buttononClick={()=>setMyState((prev)=>!prev)}>CLICK ME</button><divstyle={{height: "150vh"}}>long div 3</div></div>)}
Browser and version - tested on chrome and firefox
OS - windows 10
lightGallery version - 2.7.2
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:
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.
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: