Skip to content

Commit

Permalink
fix(a11y): fix slide on focus when loop mode is enabled
Browse files Browse the repository at this point in the history
fixes #7540
  • Loading branch information
nolimits4web committed May 17, 2024
1 parent dd46c69 commit fc8ed1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/a11y/a11y.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,12 @@ export default function A11y({ swiper, extendParams, on }) {
}
requestAnimationFrame(() => {
if (preventFocusHandler) return;
swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
if (swiper.params.loop) {
swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0);
} else {
swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
}

preventFocusHandler = false;
});
};
Expand Down

0 comments on commit fc8ed1a

Please sign in to comment.