Paul Bean
I have noticed that the aria-label and aria-describedby attributes are being used on <div> elements that act as buttons for opening and closing the accordions. As you might be aware, according to the W3C standards, the
aria-label and
aria-describedby attributes are meant to be used with interactive elements or elements that have a semantic meaning, such as form elements or links, rather than generic container elements like <div>. Changing the markup to something like
<h2><button id="header-1" aria-controls="panel-1" aria-expanded="[true || false state]">Title of header</button></h2>
would do the trick.
Resources:
w3c.github.io/aria/#generic
https://tinyurl.com/yu555se4
Also, please note that I'm using <h2> in my example, but you use <h3>. I haven't found a way to change that, but we need a solution to avoid skipping a heading level, which is also a violation of the Accessibility standards. I'm thinking of something like
{accordion title="My title" heading="h3"}
, but maybe you already have that feature and I haven't seen it.
Thanks. Keep up the good work.