How-to Guide

Collapsible FAQ and Accordion Sections

Short answer

A collapsible FAQ should put each question in a real heading with a button inside, show whether the answer is open or closed, and keep the answer text in the page's HTML. Then people using a keyboard or screen reader, and search engines, can all read it.

By Liam CostelloUpdated 5 min read
Get my free auditor call (561) 291-2681

Why practices use collapsible questions

A counseling practice page with eight questions and answers can run to a full screen of text on a phone. Collapsing the answers keeps the page short, so a visitor sees the questions first and opens only the ones they care about. That is a sensible choice, as long as the collapsing is built so that nobody is locked out.

Two groups can be locked out by a badly built accordion. One is people who use a keyboard or a screen reader. The other is search engines, which read the page's code, not its appearance. This guide covers both, using two primary sources that we read directly. The same logic applies to the page itself, where named header, menu and main regions let a screen reader jump to the part of the page a visitor needs.

What the W3C accordion pattern requires

The W3C's ARIA Authoring Practices Guide describes an accordion as a stack of headings that show and hide their panels. The pattern has a short list of rules.

  • Each title is a button, and that button sits inside a heading element. The button must be the only thing inside the heading, with other items kept outside it.
  • The heading's level should fit the page's outline. A native heading element can supply this.
  • The button carries aria-expanded, set to true when its panel is showing and false when it is hidden.
  • The button carries aria-controls, naming the panel it opens.
  • Enter or Space opens a closed panel and closes an open one. Tab and Shift plus Tab move between the controls in the normal order.
  • A region role on each panel is optional, and the guide advises skipping it when many panels can be open at once, around six or more, so a screen reader does not announce too many landmarks.

What Google can and cannot see

Google's JavaScript basics page explains that Google renders the page and indexes the rendered HTML, and that content missing from that rendered HTML cannot be indexed. That page does not mention accordions by name, so we do not claim it does. The practical lesson is to check what Google actually sees.

  1. 1Prefer an accordion that keeps every answer in the page's HTML and only hides it visually until opened.
  2. 2Be careful with versions that fetch an answer only after a click. If the text is never in the rendered HTML, a search engine may never read it.
  3. 3Check with Google's URL Inspection tool or the Rich Results Test, as the page recommends, and look at the rendered HTML for a sentence from a closed answer.

Markup and visible text must tell the same story

If you add FAQ markup, the questions and answers in it should be the same as the visible ones. Our guide on FAQ schema after Google limited FAQ rich results explains what the markup can and cannot do now.

What the answers should say

On a counseling page, answers should describe how the practice works: how to book, how long a first visit lasts, what to bring, how fees are handled and what to do in an emergency. They should not make clinical claims or promise results. See our guides to an FAQ page for a therapy practice and how to write patient FAQs that answer AI search.

CheckHow to test it
KeyboardPress Tab until a question is focused, then Enter or Space. The answer should open and close
Screen readerAsk a staff member or tester to listen; each question should be announced as a button that is expanded or collapsed
PhoneEach question is easy to tap with a thumb and the open answer does not run off the screen
Search engineA sentence from a closed answer appears in the rendered HTML in the inspection tool
Emergency lineThe crisis wording stays visible and is never hidden inside a collapsed panel

Do not hide the most important answer

A patient in distress needs to see how to reach help right away. Put the emergency and crisis wording in plain view on the page, outside any panel. Keep the first one or two questions open by default if the page has only a few, and let the rest collapse.

If your page has fewer than five questions, consider skipping the accordion altogether. Plain headings and short answers are the simplest format for every reader and every crawler. Whatever you choose, pop-up menus and tooltips that vanish when the pointer moves have their own rules, covered in our guide on menus and tooltips that vanish before a client can read them.

Frequently asked questions

Does Google ignore text inside a collapsed panel?

Google's documentation says it indexes the rendered HTML, so what matters is whether the answer is present there. Check a closed answer with the URL Inspection tool.

Is a plain list of questions safer than an accordion?

For a short list, yes. It has no controls to get wrong. Use an accordion when the list is long enough that scrolling becomes a burden.

Does the W3C pattern require arrow keys?

The pattern page we read describes Enter, Space and Tab. It does not describe arrow keys as part of the pattern, so do not rely on them.

Can the whole page be one accordion?

We advise against it. Keep the main content open and use panels only for secondary questions.

Who can check this for us?

Your web person, with the keyboard and rendered-HTML tests above. You can repeat the keyboard test yourself in about two minutes.

Sources

Keep reading

Ready to Grow Your Practice?

Primara is now accepting new independent practices nationwide. Most new engagements begin within one week.

Send Us a Message

We respond within one business day.

* Required field

We'll call to confirm your consultation.

No spam, ever. HIPAA-aware agency. We respond within one business day. For urgent inquiries, call (561) 291-2681.

Founder-LedHIPAA-AwareServing Practices Nationwide