Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jason-dark opened this issue Feb 13, 2021 · 6 comments

Comments

@jason-dark
Copy link

jason-dark commented Feb 13, 2021

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)
@kmsarsam
Copy link

kmsarsam commented May 17, 2021

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.

@jwugit
Copy link

jwugit commented Oct 18, 2021

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

@bekk-goody
Copy link

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

@oliviertassinari
Copy link
Owner

oliviertassinari commented Aug 5, 2023

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.

@vagnermaltauro
Copy link

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

@tarektarho
Copy link

Hello everyone, will this be resolved anytime soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants