kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.49k stars 5.89k forks source link

Counter `x of y` is wrong on slick dots button's `aria-label` #4195

Closed bboro closed 2 years ago

bboro commented 2 years ago

The counter for the aria-label for slick dots is calculating the totals wrong when slidesToShow and slidesToScroll settings are different. Currently slick's dividing the total number of slides by slidesToShow. This ends up creating labels for slick dots such as aria-label="6 of 2" which is plain wrong. It should instead divide the total number of slides by slidesToScroll.

====================================================================

[http://jsfiddle.net/3dau6hkb/3/]

====================================================================

Steps to reproduce the problem

(Same as jsfiddle link above)

  1. Create a slick slideshow with 6 slides.
  2. Set slidesToShow: 3, slidesToScroll: 1, dots: true
  3. Inspect the aria-label property of the dots buttons.

====================================================================

What is the expected behaviour?

Dots buttons* should say aria-label="[x] of 6", the total number of dots should be correctly marked as 6.

====================================================================

What is observed behaviour?

Dots buttons* say aria-label="[x] of 2", the total number of dots is calculated as 2 instead of 6.

====================================================================

More Details

ahmadalfy commented 2 years ago

That's a nice catch, thank you.

ahmadalfy commented 2 years ago

Merged