A webpage should make sense even when someone cannot see its colors, pictures, or layout.
What You Need to Know
Details and summary let visitors open optional content without writing JavaScript. The summary is the visible, focusable heading-like control. Make its wording specific enough that someone knows what will open.
In this example: build an accessible FAQ disclosure.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<details>
<summary>What is semantic HTML?</summary>
<p>It uses elements that explain what each part of a page means.</p>
</details>
Let’s Read the Code
- <details>: Details makes a section expandable without requiring a custom script.
- <summary>: Summary is the label people activate to expand or collapse details.
Read the named elements and attributes together. They explain how the browser connects this feature to the rest of the page.
What Happens in the Browser?
Try this with Tab and Shift+Tab. If you can, inspect the accessibility tree too; appearance alone does not tell the whole story.
Try a different way of reading. Read only the headings and labels, or navigate through links without looking at the rest of the page. If the page still makes sense, the underlying HTML is probably doing an important part of its job.
Your Turn
Use Tab and Shift+Tab to visit the controls, then read their labels aloud. Is the purpose of each one clear?
Common Beginner Mistakes
- Judging the page only by how it looks, without checking its meaning and keyboard behavior.
- ARIA changes what assistive technology is told; it does not automatically add keyboard controls, visual styling, or JavaScript behavior.
Key Takeaways
- Details and summary let visitors open optional content without writing JavaScript.
- <details>: Details makes a section expandable without requiring a custom script.
- A meaningful HTML element is usually a stronger starting point than adding an ARIA role to a generic div. Also check what happens using only the keyboard.