Skip to main content

This is a draft (version 0.5.0). The National Information Technology Agency (NITA) plans to make GGDS official guidance for government websites after independent accessibility testing. What this means

Ghana Government Design System Design system for Government of Ghana websites – home Search

Navigation

Contents list

"On this page": links to the sections of a long page, so people can go straight to the part they need.

When to use

  • On a page with three or more sections under <h2> headings, such as guidance or a service's rules.

When not to use

  • On a short page that fits on a phone screen or two.
  • To link to other pages: use side navigation.

How to use

  • Put it after the page's heading and introduction, before the first section.
  • Link to each <h2> by its id, with the heading's own words.
  • Keep it in the same order as the page.

Accessibility

What GGDS does

  • The list is a navigation landmark named by its heading, so screen reader users can find it.
  • The dash before each link is drawn and not read out.

What you need to do

  • Give every heading it links to a unique id, and keep the links working when a heading's words change.
  • If there is more than one contents list on a page, give each a different id for its title.

Example: Contents list

Open this example on its own page

HTML code for “Contents list”
HTML
<nav class="ggds-contents" aria-labelledby="contents-title">
  <h2 class="ggds-contents__title" id="contents-title">On this page</h2>
  <ol class="ggds-contents__list">
    <li><a class="ggds-contents__link" href="#who-needs-a-licence">Who needs a licence</a></li>
    <li><a class="ggds-contents__link" href="#what-it-costs">What it costs</a></li>
    <li><a class="ggds-contents__link" href="#how-to-apply">How to apply</a></li>
  </ol>
</nav>
JSX (React)
<nav className="ggds-contents" aria-labelledby="contents-title">
  <h2 className="ggds-contents__title" id="contents-title">On this page</h2>
  <ol className="ggds-contents__list">
    <li><a className="ggds-contents__link" href="#who-needs-a-licence">Who needs a licence</a></li>
    <li><a className="ggds-contents__link" href="#what-it-costs">What it costs</a></li>
    <li><a className="ggds-contents__link" href="#how-to-apply">How to apply</a></li>
  </ol>
</nav>

Use it

Stylesheet
ggds.css includes it. To load only the parts you use: core.css, then components/navigation.css (0.9 KB with gzip, minified), which also holds breadcrumbs, pagination and tab links.
JavaScript
None needed.

HTML

Copy the HTML under each example above. It works in any website.

Astro

With @ggds/astro:

JavaScript
import Contents from '@ggds/astro/Contents.astro';

<Contents items={[{ label: 'What it costs', href: '#what-it-costs' }]} />

React and Next.js

No React component: switch the HTML under an example to JSX (React) and copy it.

Django

With ggds-django ({% load ggds %}):

Django template
{% ggds_contents items %}

Classes and states

Classes for contents list
ClassWhat it does
.ggds-contentsThe list of the page's own sections.
.ggds-contents__title"On this page".
.ggds-contents__listThe sections, in the order they appear.
.ggds-contents__linkA link to a section's heading.

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
  • Behaviour test: “no horizontal scrolling at 320px”
  • Behaviour test: “no horizontal scrolling at 320px with a wide font”

By people, with assistive technology

Automated tests find only some of the barriers people meet. These checks are still to be done.

Manual accessibility checks for contents list
CheckResultNotes
Keyboard onlyNot tested yetWaiting for the external audit with disabled people (decision D-09).
NVDA screen reader with Firefox or Chrome (Windows)Not tested yetWaiting for the external audit with disabled people (decision D-09).
JAWS screen reader with Chrome (Windows)Not tested yetWaiting for the external audit with disabled people (decision D-09).
VoiceOver screen reader with Safari (iPhone)Not tested yetWaiting for the external audit with disabled people (decision D-09).
TalkBack screen reader with Chrome (Android)Not tested yetWaiting for the external audit with disabled people (decision D-09).
Zoom to 400%, and increased text spacingNot tested yetWaiting for the external audit with disabled people (decision D-09).
Windows contrast themes (forced colours)Not tested yetWaiting for the external audit with disabled people (decision D-09).
Voice control (Voice Access or Dragon)Not tested yetWaiting for the external audit with disabled people (decision D-09).

Changes

Changes to contents list, newest first
VersionChange
0.4.0New components: back link, side navigation, contents list ("On this page"), language switcher, phase banner, cookie banner and character count, in HTML, Django, React and (except the character count) Astro. All are alpha: tested automatically, not yet on a live website. The cookie banner needs no JavaScript: its buttons send a form, and both choices look the same.
0.1.0Added.

Every change, in What’s new

  • Side navigation

    The pages of one section of a website, beside its content, so people can move between them.

  • Prose (rich text)

    Styles for text from a content management system.

Back to top

Something wrong, unclear or missing? Report a problem with this page or suggest a change to it on GitHub. You need a GitHub account.