Estimated reading time : 4 min · Published
Separate the answer from supporting detail
The main answer, offer limitations and instructions needed to act can remain visible. Keeping panels for supporting material avoids making everyone guess where an important condition is hidden. Try the page with someone unfamiliar with its headings.
Each label should predict the content: “Documents to prepare” is more useful than “Information”. Merge overlapping panels or clarify their difference. Where people compare options, allow sections to stay open together or offer a presentation suited to comparison.
Choose native disclosure or a composed accordion
HTML details and summary provides native content disclosure. A composed accordion can follow the W3C pattern with named controls and communicated expansion state. Do not make a tiny icon the only trigger; the title should be a usable target.
Consider links to an answer, in-page search and printing. Test these uses in relevant browsers. If a link arrives at collapsed content, arrange appropriate expansion or provide a visible section from which the answer can be found.
Fictional case: three disclosures explain timing, documents and follow-up. Independent details elements let readers keep several answers open for comparison. The same non-empty name attribute puts them in an exclusive group: opening one closes the other. Use this grouping only where it helps; three answers that need comparison may not benefit from closing one another. The first summary supplies the disclosure label.
Then distinguish native HTML from a custom accordion. For details, the presence of open reveals content: open="false" is still present, whereas removing the attribute closes the disclosure. In the W3C accordion pattern, the button carries aria-expanded="true" or "false" to match the panel’s actual visibility, and aria-controls targets its ID. These ARIA attributes do not perform the opening themselves. Check Enter, Space, Tab and Shift+Tab; a link in a genuinely hidden panel must not remain in the keyboard path.
Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.
| Test case | Declaration examined | Result to check |
|---|---|---|
| Closed native disclosure | details without open | Only the summary is initially displayed |
| Misleading text value | open="false" | Content is open; the details.open property is true |
| Three details sharing one name | Non-empty exclusive group | Opening one closes the already open member of the group |
| Collapsed custom accordion | aria-expanded="false" and aria-controls | The associated panel is actually hidden and its links leave the keyboard path |
Keep states understandable
With several open sections, readers should know what is displayed. If only one may be open, ensure switching does not cause a confusing jump. A simple disclosure should not automatically send focus into its content.
Editorial FAQs may use panels, but the questions and answers must match the published text. Include a long answer, a link within it and a translated two-line heading in testing. Collapsing content does not remove the need for fact checking or maintenance.
Example: prepare an initial enquiry
Educational example: a service page keeps the offer and essential terms visible. Supporting sections cover documents, process and follow-up questions. The reader opens “Documents to prepare”, copies the list and returns to the form. Testing checks that an emailed link helps find the list without losing the reading position.
Show supplementary information without hiding essential decision criteria.
Synthetic case: a card collapses technical explanations in details while keeping essential terms visible. Open it with Enter and Space and check focus. To close it through script, remove the open attribute: the text ‘false’ still leaves it present. Also test printing and links into initially collapsed content.
- Supplementary content is keyboard accessible and essential terms remain visible before an action.
- MDN HTML Details
HTML disclosure element pairing collapsible content with a summary label without a dedicated script.
Reference documents
- details and summary · Source consulted
- W3C pattern · Source consulted
- W3C WAI : Disclosure pattern · Source consulted
- WHATWG : HTML details · Source consulted
Content updated on
