react-swipeable-views icon indicating copy to clipboard operation
react-swipeable-views copied to clipboard

Attribute aria-hidden="true" on unfocused tabs is lowering Lighthouse accessibility score

Open jason-dark opened this issue 3 years ago • 6 comments

When running Lighthouse accessibility tests, points are being deducted for the non-focused tabs within the React Swipeable Views component as they have the aria-hidden="true" attribute set.' Within my tabs I do have some anchor links which are focusable, hence the error.

Lighthouse report: image

The offending div elements: image

Here is the link to the Google article explaining why the test pulls this up as an issue. In my humble opinion just how much of an issue this actually is is debatable, but nonetheless it's being flagged.

  • [x ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Ideally this could be changed so that points are not deducted from the Lighthouse accessibility score.

Current Behavior

Points are being deducted from the Lighthouse accessibility score.

Steps to Reproduce (for bugs)

Run a Lighthouse test on any site that is running a React Swipeable Views component that has focusable elements within the tabs and this comes up as an issue in the accessibility section.

Context

A Gatsby website I am building is nearing launch so I am doing final optimisations. Part of this is checking that accessibility is as good as possible for visually impaired users.

Your Environment

Tech Version
react-swipeable-views 0.13.9
React 16.13.1
platform Window 10 (tested Lightouse in Brave Browser and Chrome)

jason-dark avatar Feb 13 '21 10:02 jason-dark

You can get around this by setting overscanSlideAfter={0} but that can cause slower loading. Alternatively, you can get around this if you keep track of the index you are using, and use that index in the slideRenderer function to conditionally set the style of the slide based on whether the index is the active one. For example,

 const slideRenderer = ({index, key}: SlideRenderProps) => (
    <div key={key} style={index !== activeStep ? {display: 'none'} : {width: '100%'}}>
...```

This removed the lighthouse error for me.

kmsarsam avatar May 17 '21 16:05 kmsarsam

I know this library doesnt officially support multiple slides per view, but it is doable when using overscanSlideAfter and allowing overflow visible on the slide container.

But doing so, i have this same issue "Ensures aria-hidden elements do not contain focusable elements"

Is there a way to allow overscanSlideAfter/overscanSlideBefore have aria-hidden="false" for those renders? @oliviertassinari

jwugit avatar Oct 18 '21 21:10 jwugit

@oliviertassinari Also having the same issue with a clients screen reader. Is there a way to turn off aria-hidden=true

bekk-goody avatar Nov 22 '22 15:11 bekk-goody

I have noticed the same on http://mui.com/

Screenshot 2023-08-05 at 19 38 33

https://pagespeed.web.dev/analysis/https-mui-com/vea1v8so3w?form_factor=mobile


I suspect we can solve this with pointer-events.

oliviertassinari avatar Aug 05 '23 17:08 oliviertassinari

did anyone find a solution for this? I have the same problem!

vagnermaltauro avatar Aug 15 '23 15:08 vagnermaltauro

Hello everyone, will this be resolved anytime soon?

tarektarho avatar Dec 04 '23 13:12 tarektarho