Enforce ARIA rule
See original GitHub issueDESCRIPTION
We can find slick-slides
that have aria-hidden="true"
and tabindex="-1"
attributes. This breaks the ARIA rules to have any tabindex value (indicating the element is focusable) whilst also having the hidden flag for an element.
Found with ‘Axe’ Chrome extension to flag accessibility issues Docs: https://dequeuniversity.com/rules/axe/3.2/aria-hidden-focus?application=AxeChrome
Replicate here: https://codesandbox.io/s/ppwkk5l6xx
CURRENT:
<div data-index="2" class="slick-slide" tabindex="-1" aria-hidden="true" style="outline: none; width: 430px;"></div>
EXPECTED:
<div data-index="2" class="slick-slide" aria-hidden="true" style="outline: none; width: 430px;"></div>
Solution: tabindex attibute should be removed when aria-hidden="true"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:25
- Comments:16
Top Results From Across the Web
Using ARIA - W3C
2.5 Fifth Rule of ARIA Use. All interactive elements must have an accessible name. An interactive element only has an accessible name when...
Read more >WAI-ARIA basics - Learn web development | MDN
WAI-ARIA Authoring Practices — very detailed design patterns from the W3C, explaining how to implement different types of complex UI control ...
Read more >Angular ESLint Rules for ARIA - DEV Community
Enforces using semantic DOM elements over the ARIA role property. This rule prevents content or container elements like <span> or <div> from ...
Read more >ARIA Made Easy | IT Accessibility - University of Arizona
Rule #1: Don't use ARIA! ... ARIA is intended as a Band-Aid when standard HTML controls and markup cannot be used. Whenever possible...
Read more >Using CSS to Enforce Accessibility - Adrian Roselli
I am a big proponent of the First Rule of ARIA (don't use ARIA). But ARIA brings a lot to the table that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any updates on this issue? Is someone actively working on this? I’m also experiencing the same problem and the removal of tabindex=“-1” would make life easier
Hey @diazmaria!
Just fixed the problem externally by adding a
hidden
attribute to the container of non-active slides.activeSlide
=>const [activeSlide, setActiveSlide] = useState(0)
beforeChange={(_, next) => setActiveSlide(next)}
onreact-slick
hidden={activeSlide !== i ? true : undefined}
on the container of the slide.Reference: https://web.dev/aria-hidden-focus/#how-to-fix-partially-hidden-focusable-elements