swiper icon indicating copy to clipboard operation
swiper copied to clipboard

swiper.update() does not add aria-label

Open jonnitto opened this issue 1 year ago • 0 comments

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://codepen.io/jonnitto/pen/MWNeowV/888093ea5782303c4e5c4abd87fb6eeb

Bug description

I use swiper in a CMS where the slide can get updated from the markup. But if I run swiper.update() afterwards, the aria-label will not be added. But I use this value to go to the slide if a user clicks on the content element on the content tree (which is outside of the preview frame).

In the CodePen link you'll see, if you remove the aria-labels and click on swiper.update(), the labels will not get added again.

I also added a workaround as an example:

swiper.prependSlide('<div class="swiper-slide"></div>');
swiper.removeSlide(0);

Expected Behavior

The aria-label will get added again

Actual Behavior

The aria-label is missing

Swiper version

11.1.14

Platform/Target and Browser Versions

macOS 15.0.1, in every Browser (Chrome, Safari, etc.) always the newest version

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.
  • [X] Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • [X] I'm willing to open a PR, but I need help where to start :wink:

jonnitto avatar Oct 05 '24 21:10 jonnitto