From c8b4af2cd3cde9f9f3b4dc4bd2e11baaf4be16e7 Mon Sep 17 00:00:00 2001 From: Jesse Schlothauer Date: Wed, 5 Mar 2025 19:26:44 -0500 Subject: [PATCH] Bugfix: carousel.js This fixes an issue with the navigation dots where multiple can be selected at once, due to aria-selected not being updated until scrollend. --- carousel/carousel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/carousel/carousel.js b/carousel/carousel.js index e65f3e51..2fcc57e7 100644 --- a/carousel/carousel.js +++ b/carousel/carousel.js @@ -224,6 +224,11 @@ export default class Carousel { return e.target.setAttribute('aria-selected', true) + // deselect any other pagination dots + Array.from(this.elements.pagination.children) + .filter(x => x !== e.target) + .forEach(dot => dot.setAttribute('aria-selected', false)); + const item = this.elements.snaps[this.#getElementIndex(e.target)] this.goToElement({