Search
Enter at least two characters without personal information.

    LibraryArticles & FAQ Your projectRequest a quote
    LanguageEN
    Practical guides

    Organise content with accordions and disclosures

    An accordion groups sections people can open and close. It saves initial space but adds discovery effort. Decide which information should be immediately available and which is supporting detail before choosing the interaction.

    Go to the method

    Laptop displaying sections and folded notes
    AI-generated illustration

    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

    Three HTML cases: details without open returns false; open present, even written false, returns true for the details.open property.
    Illustration · Reading the diagram: details.open reflects the presence of the Boolean open attribute. The fragments are syntax examples, not active controls.

    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.

    Fictional exercise: HTML presence, exclusive group and ARIA state
    Test caseDeclaration examinedResult to check
    Closed native disclosuredetails without openOnly the summary is initially displayed
    Misleading text valueopen="false"Content is open; the details.open property is true
    Three details sharing one nameNon-empty exclusive groupOpening one closes the already open member of the group
    Collapsed custom accordionaria-expanded="false" and aria-controlsThe 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

    Content updated on

    Acceptance matrix to adapt to your project

    These proposed checks use synthetic cases. Decide the required behaviour with the team, record the result and assign unresolved gaps before release.

    Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.

    Test cases, expected outcomes and useful evidence
    CaseExpected outcomeEvidence to retain
    Panel titleReaders can predict its contentsClosed panel title and information a reader expects to find after opening it.
    Keyboard controlExpansion and collapse report the correct stateKeys and observed state
    Link to detailThe target answer can be foundFragment URL and destination
    Print and translationUseful information remains readablePrint output and long heading

    Frequently asked questions

    Should everything start closed?

    Essential information may stay expanded or outside the panels. Choose according to what people need immediately.

    Is an accordion better than a long page?

    Not necessarily. Headings and a contents list may support reading without extra interactions. Compare both on the actual task.

    Can a panel contain a form?

    Check that errors and affected fields stay reachable when another panel opens. People should recover without losing their values.