Skip to content

Commit 252596b

Browse files
JonasJesus42claude
andcommitted
fix(gallery): sync thumbnail strip to the active image (DECO-5280)
When the main image advances (arrow/swipe/keyboard), scroll the active dot into view so the thumbnail strip keeps the current thumb visible — matters for the PDP gallery with many images. - Slider observer: dot?.scrollIntoView({ block: "nearest", inline: "nearest" }). `nearest` is a no-op for small dot rows (Carousel/Logos) and never scrolls the page; only scrollable strips (gallery thumbnails) move. The issue's other two parts already work: variant→image switch (variant nav reloads page.product → filterImagesForVariant) and zoom-modal prev/next arrows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c30eb3d commit 252596b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/components/ui/Slider.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ function useSlider(
123123
if (entry.isIntersecting) {
124124
dot?.setAttribute("disabled", "");
125125
dot?.setAttribute("aria-current", "true");
126+
// Keep the active dot in view — matters for scrollable thumbnail
127+
// strips (e.g. the PDP gallery with many images). `nearest` only
128+
// scrolls when needed, so it's a no-op for the small dot rows of
129+
// the Carousel/Logos sliders and never scrolls the page.
130+
dot?.scrollIntoView({ block: "nearest", inline: "nearest" });
126131
} else {
127132
dot?.removeAttribute("disabled");
128133
dot?.removeAttribute("aria-current");

0 commit comments

Comments
 (0)