Observation Details
FAQ section cannot be operated (expand / collapse) by keyboard navigation as the interactive elements are custom built and do not use correct semantic HTML. The FAQ accordion uses an HTML description list <dl>. Example code:
<dt class="accordion__term" data-accordion="term" tabindex="0">
<h3 class="accordion__title">...</h3>
</dt>
<dd
class="accordion__description accordion__description--hidden"
data-open-class="accordion__description--open"
data-hidden-class="accordion__description--hidden"
data-accordion="description"
>
<div class="accordion__content">
<p class="paragraph">...</p>
</div>
</dd>Observations about the example code:
Description lists consist of terms and descriptions. An FAQ question item can not be considered a term.
Setting
tabindex="0"to allow keyboard focus of non-interactive element is bad practice and should be avoideddata-*attributes in description try to build accordion functionality<div class="accordion__content">is an unnecessary hierarchy levelA CSS paragraph class
<p class="paragraph">should not ever be needed
Remediation Notes
Ensure, using correct semantic HTML elements for all interactive elements. In case of accordions, these could be <detail> and <summary> constructs or ones with <button> as the accordion item "header".
Keyboard navigation is a must.
For custom building an accessible accordion component, please refer to BFIT-Bund Handreichung "Accessible design of user interface elements – Accordion".