Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(a11y): fix argments for initNavEl() method #4884

Merged
merged 1 commit into from
Aug 30, 2021
Merged

fix(a11y): fix argments for initNavEl() method #4884

merged 1 commit into from
Aug 30, 2021

Conversation

yuheiy
Copy link
Contributor

@yuheiy yuheiy commented Aug 28, 2021

When I using the a11y module, the aria-label and aria-controls values applied to the navigation buttons are incorrect.

Reproduction code:

import Swiper, { A11y, Navigation } from "swiper";

new Swiper(".swiper", {
  modules: [A11y, Navigation],
  a11y: {},
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
});
<div class="swiper">
  <div class="swiper-wrapper">
    <div class="swiper-slide">Slide 1</div>
    <div class="swiper-slide">Slide 2</div>
    <div class="swiper-slide">Slide 3</div>
  </div>
  <button class="swiper-button-prev" type="button">Previous</button>
  <button class="swiper-button-next" type="button">Next</button>
</div>

Result:

<button class="swiper-button-prev swiper-button-disabled" disabled="" tabindex="-1" aria-label="undefined" aria-controls="Previous slide" aria-disabled="true">Previous</button>
<button class="swiper-button-next" tabindex="0" aria-label="undefined" aria-controls="Next slide" aria-disabled="false">Next</button>

The reason for aria-label="undefined", aria-controls="Previous slide" and aria-controls="Next slide" is that the arguments given to initNavEl() are wrong.

@yuheiy yuheiy mentioned this pull request Aug 28, 2021
16 tasks
@nolimits4web nolimits4web merged commit 2987700 into nolimits4web:master Aug 30, 2021
@nolimits4web
Copy link
Owner

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants