third_party/aria-practices/src/content/patterns/disclosure/examples/disclosure-faq.html
The following example demonstrates using the Disclosure Pattern to create a set of frequently asked questions where the answers may be independently shown or hidden.
Similar examples include:
ul and li elements. To ensure the list structure is communicated to assistive technologies, a button element containing the question and a div element containing answer are children of an li element. NOTE: The button actions are used to hide and show the div element with the answer.currentcolor value for the stroke and fill properties of the polygon elements used to draw the arrows. If specific colors were instead used to specify the polygon properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the arrows and the background or even make the arrows invisible if the color matched the high contrast mode background.forced-color-adjust property set to auto for the currentcolor value to be updated in high contrast mode. Some browsers do not use auto for the default value.| Key | Function |
|---|---|
| Tab | Moves keyboard focus to the disclosure button. |
| Space or | |
| Enter | Activates the disclosure button, which toggles the visibility of the answer to the question. |
| Role | Attribute | Element | Usage |
|---|---|---|---|
aria-controls="ID_REFERENCE" | button | Identifies the element controlled by the disclosure button. | |
aria-expanded="false" | button |
[aria-expanded="false"]) are used to synchronize the visual states with the value of the aria-expanded attribute.:before pseudo element and content property so the image is reliably rendered in high contrast mode of operating systems and browsers.|
| | aria-expanded="true" | button |
[aria-expanded="true"]) are used to synchronize the visual states with the value of the aria-expanded attribute.:before pseudo element and content property so the image is reliably rendered in high contrast mode of operating systems and browsers.|
Learn how to interpret and use assistive technology support data
To copy the following HTML code, please open it in CodePen.