fix: scrollbar on thumbnails

This commit is contained in:
Julien Froidefond
2025-02-16 21:22:49 +01:00
parent 9cca472953
commit 18a3bc1d5b

View File

@@ -22,11 +22,21 @@ export const NavigationBar = ({
currentPage,
});
// Scroll à l'ouverture des contrôles et au changement de page
useEffect(() => {
if (showControls) {
scrollToActiveThumbnail();
requestAnimationFrame(() => {
const thumbnail = document.getElementById(`thumbnail-${currentPage}`);
if (thumbnail) {
thumbnail.scrollIntoView({
behavior: showControls ? "instant" : "smooth",
block: "nearest",
inline: "center",
});
}
}, [showControls, currentPage, scrollToActiveThumbnail]);
});
}
}, [showControls, currentPage]);
return (
<div