Native details and summary for an FAQ Accordion: What You Get for Free and What Is Left to Do
Short answer: A <details> element with a <summary> gives you an expand and collapse control that works with mouse, touch, keyboard and screen readers, with no script and no ARIA attributes. The summary is focusable, Enter and Space toggle it, and the open state is announced. What you still own is the visual design, a clear focus outline, sensible heading structure, and a decision about whether opening one item should close the others. For most FAQ pages on small business sites, native elements are the more robust choice than a custom accordion.
Anatomy of the pattern
<details>
<summary>Do you cover Cork and Kerry?</summary>
<p>Yes, we travel across both counties on weekdays.</p>
</details>
There are only two parts. The <summary> is the visible question and the control. Everything else inside <details> is the answer, hidden until opened. Adding the boolean attribute open starts the item expanded.
What the browser does for you
- Focus: the summary joins the tab order automatically.
- Keys: Enter and Space toggle it.
- Announcement: assistive technology reports it as a disclosure with an expanded or collapsed state.
- No-script resilience: it works if your JavaScript bundle fails to load, which a custom accordion would not.
- Find in page: in current Chromium browsers, text inside a closed item can be found and the item opens to show the match. Support varies, so test the browsers your visitors use.
What you still have to do
| Task | Why it matters |
|---|---|
| Style the marker | The default triangle is small; make the whole summary row a comfortable tap target |
| Keep a visible focus ring | Many resets remove outlines on summary elements |
| Do not nest links or buttons inside the summary | Interactive content inside an interactive summary confuses keyboard and voice users |
| Decide the heading level | A summary is not a heading, so structure for navigation needs thought |
| Write answers as real content | Hidden text is still part of the page, so keep it honest and useful |
The heading question
Screen reader users often navigate by headings. If your FAQ questions are only summaries, they will not appear in a heading list. There are two sensible approaches. One is to place a heading above the whole FAQ block and leave the items as disclosures, which is the simplest and usually enough for five to ten questions. The other is to wrap text in a heading inside the summary, such as <summary><h3>...</h3></summary>. Browser and assistive technology behaviour with that nesting has varied, so test it with the tools you can access before committing. Avoid putting a heading level that skips the page hierarchy.
Making it look like an accordion
Add padding to the summary and hide the default marker if you replace it:
summary { cursor: pointer; padding: 1rem 1.25rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; float: right; }
details[open] summary::after { content: "\2212"; }
summary:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
Keep contrast between summary text and its background at the standard recommended ratios, and do not rely on the plus and minus alone to signal state, since the browser already exposes it programmatically. A change in background colour when open helps sighted users too.
One open at a time, or many
Native items are independent: opening one leaves the others open. That is usually better for people who compare answers. If you really want exclusivity, give the elements the same name attribute, for example name="faq", which current browsers treat as a group where opening one closes the rest. As of November 2026 support is good in recent browsers and older ones simply keep items independent, which is an acceptable fallback.
Deep links to a question
A link like /faq/#returns should open the right item. Native <details> does not open itself from a fragment in every browser. Give the details element the id and add a short script that, on load and on hashchange, sets open on the matching element. Chromium based browsers also reveal closed content when it is the target of a fragment, but do not assume it everywhere.
Animation without breaking it
People like a smooth open. You can animate the height with newer CSS features or by wrapping content, but keep the default behaviour working without them. Respect the reduced motion preference with a media query so animations are skipped for visitors who asked for fewer movements.
When to prefer something else
Native disclosure suits a list of independent questions. It is weaker for a complex tabbed interface, a vertical navigation tree with arrow-key movement, or a pattern where only one panel may ever show while the layout needs an animation synchronised across items. In those cases a library written to the ARIA authoring guidelines is the better route, and you should test it with a keyboard before launch.
A quick audit checklist
- [ ] Tab reaches every summary in order.
- [ ] Enter and Space both toggle.
- [ ] Focus outline is visible against the background.
- [ ] Zoom to 200 percent and nothing is clipped.
- [ ] Printing shows the answers (add
details > *display rules or open them in a print stylesheet). - [ ] The FAQ block has one heading above it.
- [ ] Search engines can read the answers, because they sit in the HTML.
FAQ
Do I need aria-expanded on summary?
No. The browser exposes the state itself. Adding it by hand risks the attribute going out of step with the real state.
Will Google show my FAQ answers if they are hidden?
Content in a closed details element is in the HTML and can be indexed. Structured data for FAQs has had restricted eligibility for rich results, so do not build the page around that.
Can I put images inside an answer?
Yes. Treat them like any content: give them alt text and keep them lightweight, since they load even while closed unless you lazy-load them.
Why does my summary lose its triangle?
A CSS reset such as list-style: none or display: block on summary removes it. Add your own indicator as in the example.
If your FAQ needs a rebuild that is lighter, easier to read and tested with a keyboard, send us a note via the enquiry page.