Skip to content

Commit 663d771

Browse files
authored
Merge pull request #34 from deco-sites/jonasjesus/deco-5280-gallery-thumbnail-sync
fix(gallery): sync PDP thumbnail strip to active image (DECO-5280)
2 parents c30eb3d + 252596b commit 663d771

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)