From 15e4012dd2a4f0f033dd922976ea0b90ef42dcde Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 18 Aug 2024 10:41:49 +0800 Subject: [PATCH] Fix carousel not scrolling --- src/components/media-modal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx index afa2a0be..dfdcbd64 100644 --- a/src/components/media-modal.jsx +++ b/src/components/media-modal.jsx @@ -55,11 +55,11 @@ function MediaModal({ const scrollLeft = index * carouselRef.current.clientWidth; const differentStatusID = prevStatusID.current !== statusID; if (differentStatusID) prevStatusID.current = statusID; + carouselRef.current.focus(); carouselRef.current.scrollTo({ left: scrollLeft * (isRTL() ? -1 : 1), behavior: differentStatusID ? 'auto' : 'smooth', }); - carouselRef.current.focus(); }, [index, statusID]); const [showControls, setShowControls] = useState(true);