ericbutler555 / plain-js-slidetoggle

Plain vanilla JavaScript version of jQuery's slideToggle() function. No dependencies!

Home Page:https://ericbutler555.github.io/plain-js-slidetoggle/demo.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accessibility request

angieherrera opened this issue · comments

This is a great little script - thanks for creating it!

I'd love to see it be more accessible where instead of (or in addition to) using style="display: none;" it uses the aria-hidden attribute.

Hi Angie, thanks for submitting this issue! The link you added states:

aria-hidden="true" should not be added when:

  • The HTML hidden attribute is present
  • The element or the element's ancestor is hidden with display: none
  • The element or the element's ancestor is hidden with visibility: hidden

In all three scenarios, the attribute is unnecessary to add because the element has already been removed from the accessibility tree. Visually hiding elements with display or visibility hides content from the screen and from assistive technologies.

We definitely need to set style="display: none" or else the collapsed content will just reappear after animating closed.