Content
Disclosure and accordion
Sections people can open and close, such as questions and answers.
When to use
- For extra detail that only some people need, such as "What if I do not have a Ghana Card?".
- For a list of questions and answers, where each person looks for one or two. Use an accordion.
When not to use
- For information everyone needs, such as fees, deadlines or required documents. Put it on the page.
- For short content. Showing it is quicker than opening it.
- For steps people must follow in order. Use a numbered list.
- To switch between views, like tabs. Use headings on one page, or separate pages with tab links.
How to use
- Build each section from
<details class="ggds-disclosure">, a<summary class="ggds-disclosure__summary">and aggds-disclosure__contentblock. - For several sections, put them in a
ggds-accordion. It adds lines between them. - Write each summary as the question or topic people are looking for, in under ten words.
- Start sections closed. Add
openonly when most people need that one. - Put only plain text in the summary: no links, buttons or headings.
- Do not put a disclosure inside another one.
Do
- Use the words people search for: "How do I pay?".
Don't
- Hide the fee or the deadline in a closed section.
- Write vague summaries such as "More information".
Accessibility
What GGDS does
- Built on the browser's own
<details>: it opens with Enter or Space, screen readers announce whether it is open, and it works without JavaScript. - The summary is at least 44px tall, bold and in the link colour, with the gold focus ring.
- The arrow is drawn in CSS: it points down when closed and up when open.
What you need to do
- Keep
<details>and<summary>. Do not rebuild it with<div>s and a script. - Write each summary so it makes sense on its own.
- Do not hide information everyone needs inside a closed section.
Example: Accordion of questions
<div class="ggds-accordion">
<details class="ggds-disclosure">
<summary class="ggds-disclosure__summary">How long does a licence take?</summary>
<div class="ggds-disclosure__content"><p>Most applications are decided within 30 working days of a complete application.</p></div>
</details>
<details class="ggds-disclosure">
<summary class="ggds-disclosure__summary">Can I apply on behalf of someone else?</summary>
<div class="ggds-disclosure__content"><p>Yes, with a letter of authorisation signed by the applicant.</p></div>
</details>
<details class="ggds-disclosure">
<summary class="ggds-disclosure__summary">How do I pay?</summary>
<div class="ggds-disclosure__content"><p>Online by card or mobile money, or at our offices.</p></div>
</details>
</div><div className="ggds-accordion">
<details className="ggds-disclosure">
<summary className="ggds-disclosure__summary">How long does a licence take?</summary>
<div className="ggds-disclosure__content"><p>Most applications are decided within 30 working days of a complete application.</p></div>
</details>
<details className="ggds-disclosure">
<summary className="ggds-disclosure__summary">Can I apply on behalf of someone else?</summary>
<div className="ggds-disclosure__content"><p>Yes, with a letter of authorisation signed by the applicant.</p></div>
</details>
<details className="ggds-disclosure">
<summary className="ggds-disclosure__summary">How do I pay?</summary>
<div className="ggds-disclosure__content"><p>Online by card or mobile money, or at our offices.</p></div>
</details>
</div>Example: States: closed and open
<details class="ggds-disclosure">
<summary class="ggds-disclosure__summary">Closed: what documents do I need?</summary>
<div class="ggds-disclosure__content"><p>Your Ghana Card and proof of address.</p></div>
</details>
<details class="ggds-disclosure" open>
<summary class="ggds-disclosure__summary">Open: how much does it cost?</summary>
<div class="ggds-disclosure__content"><p>GH₵ 50, paid online or at our offices.</p></div>
</details><>
<details className="ggds-disclosure">
<summary className="ggds-disclosure__summary">Closed: what documents do I need?</summary>
<div className="ggds-disclosure__content"><p>Your Ghana Card and proof of address.</p></div>
</details>
<details className="ggds-disclosure" open>
<summary className="ggds-disclosure__summary">Open: how much does it cost?</summary>
<div className="ggds-disclosure__content"><p>GH₵ 50, paid online or at our offices.</p></div>
</details>
</>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/disclosure.css(0.5 KB with gzip, minified).- JavaScript
- None needed.
HTML
Copy the HTML under each example above. It works in any website.
Astro
No Astro component: copy the HTML.
React and Next.js
No React component: switch the HTML under an example to JSX (React) and copy it.
Django
No template tag: copy the HTML into your template.
Classes and states
| Class | What it does |
|---|---|
.ggds-disclosure | One section that opens and closes: a <details> element. |
.ggds-disclosure__summary | The heading people click, with an arrow. |
.ggds-disclosure__content | What shows when it is open. |
.ggds-accordion | Several disclosures as one list, with lines between them. |
| State | What it does |
|---|---|
[open] | Open: the content shows and the arrow points up. |
Accessibility tests
Automated, on every change
These run each time GGDS changes. A change that fails one is not accepted.
- WCAG 2.2 A and AA rules (axe), at desktop and phone widths, on every example
- No sideways scrolling on a 320px screen, also with a wide font, on every example
- Every approved colour pair meets its contrast minimum, for every institution theme
- No inline scripts or styles, so it runs under a strict Content Security Policy
By people, with assistive technology
Automated tests find only some of the barriers people meet. These checks are still to be done.
| Check | Result | Notes |
|---|---|---|
| Keyboard only | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| NVDA screen reader with Firefox or Chrome (Windows) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| JAWS screen reader with Chrome (Windows) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| VoiceOver screen reader with Safari (iPhone) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| TalkBack screen reader with Chrome (Android) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Zoom to 400%, and increased text spacing | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Windows contrast themes (forced colours) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Voice control (Voice Access or Dragon) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
Changes
| Version | Change |
|---|---|
| 0.2.0 | Fuller guidance for tags, breadcrumbs, disclosures, the skip link, pagination, rich text, tables and tab links. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.