swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Get accessibility parameters from markup

Open alkorlos opened this issue 9 months ago • 0 comments

Clear and concise description of the problem

Currently, changing the default values of accessibility parameters is only possible with JavaScript API.

Suggested solution

When using custom markup, it would be much more convenient to change aria attributes through the attribute value.

When setting

navigation: {
  nextEl: '.swiper-button-next',
  prevEl: '.swiper-button-prev',
}

the accessibility parameters on the elements .swiper-button-next and .swiper-button-prev change the default values.

<button class="swiper-button-next" aria-label="Siguiente diapositiva"></button>

Alternative

Use JavaScript API

navigation: {
  nextEl: '.swiper-button-next',
  prevEl: '.swiper-button-prev',
},
a11y: {
  nextSlideMessage: 'Siguiente diapositiva',
  prevSlideMessage: 'Diapositiva anterior'
},

With custom markup, specifying aria attributes in HTML will be more straightforward and easier to maintain.

Additional context

No response

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this feature?

  • [ ] I'm willing to open a PR

alkorlos avatar May 20 '24 13:05 alkorlos