react-multi-carousel icon indicating copy to clipboard operation
react-multi-carousel copied to clipboard

Remove `aria-hidden` from carousel item

Open Sicria opened this issue 3 years ago • 6 comments

In a carousel, four list items are shown at the desktop breakpoint, and four are hidden offscreen. Screen readers incorrectly tell their users that this is a list of four items because offscreen items are incorrectly hidden with aria-hidden="true".

It is possible to overwrite this prop to allow not hiding the items if required.

Sicria avatar Oct 19 '20 05:10 Sicria

+1 for this, I'm having so much problem with the audit accessibility score

PhongVu07 avatar Nov 09 '20 04:11 PhongVu07

Having the same problem here. It can be solved easily by just adding a tabindex="-1".

phiberber avatar Aug 25 '21 21:08 phiberber

Hi, can you show me an example of this tabIndex workarround?

robertveloso avatar Aug 30 '21 14:08 robertveloso

I wasn't talking about a workaround. I was saying that someone could create a pull request just by adding this parameter. If you want a trick to solve this, I thought of something:

const carouselItems = Array.from(document.getElementsByClassName("react-multi-carousel-item")) carouselItems.forEach((element) => element.setAttribute("tab-index", -1))

It is an ugly hack but might work. But you need to make sure that it runs before Lighthouse checks for the carousel-item element.

phiberber avatar Aug 31 '21 02:08 phiberber

any updates on this? I'm getting low accessibility scores due to this as well. ( Other than setting tab index to -1, is there any other solutions?)

LanguageXange avatar Jan 17 '22 19:01 LanguageXange

Any solution to this pls

oluSammy avatar Nov 09 '23 06:11 oluSammy