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

Side navigation

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

When to use

  • For a section with several pages that people read in any order, such as the pages about fees or about the institution.

When not to use

  • For the whole website: that is the header's job.
  • For the parts of one page: use a contents list.
  • For the steps of a task in order: people should follow the task one page at a time.

How to use

  • Put it in the side column of ggds-with-aside. On phones it comes after the content; on desktops it sits beside it.
  • Mark the current page with aria-current="page".
  • Show the pages under the current one in an indented list, one level deep at most.
  • Use the pages' own titles as link text.

Accessibility

What GGDS does

  • The current page is shown by a line, a tint and bold text, and is announced as the current page, so it never depends on colour alone.
  • Every link is at least 44px tall.

What you need to do

  • Give the navigation a label that says what it lists, if "In this section" is not clear.
  • Keep it after the main content in the HTML, so people using a screen reader reach the page's content first.

Example: Side navigation

Open this example on its own page

HTML code for “Side navigation”
HTML
<nav class="ggds-side-nav" aria-label="In this section">
  <ul class="ggds-side-nav__list">
    <li><a class="ggds-side-nav__link" href="/services/licences/">Licences</a></li>
    <li><a class="ggds-side-nav__link" href="/services/fees/" aria-current="page">Fees and charges</a>
      <ul class="ggds-side-nav__list ggds-side-nav__list--sub">
        <li><a class="ggds-side-nav__link" href="/services/fees/broadcasting/">Broadcasting fees</a></li>
        <li><a class="ggds-side-nav__link" href="/services/fees/telecoms/">Telecoms fees</a></li>
      </ul>
    </li>
    <li><a class="ggds-side-nav__link" href="/services/type-approval/">Equipment approval</a></li>
  </ul>
</nav>
JSX (React)
<nav className="ggds-side-nav" aria-label="In this section">
  <ul className="ggds-side-nav__list">
    <li><a className="ggds-side-nav__link" href="/services/licences/">Licences</a></li>
    <li><a className="ggds-side-nav__link" href="/services/fees/" aria-current="page">Fees and charges</a>
      <ul className="ggds-side-nav__list ggds-side-nav__list--sub">
        <li><a className="ggds-side-nav__link" href="/services/fees/broadcasting/">Broadcasting fees</a></li>
        <li><a className="ggds-side-nav__link" href="/services/fees/telecoms/">Telecoms fees</a></li>
      </ul>
    </li>
    <li><a className="ggds-side-nav__link" href="/services/type-approval/">Equipment approval</a></li>
  </ul>
</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 SideNav from '@ggds/astro/SideNav.astro';

<SideNav items={items} current={Astro.url.pathname} />

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_side_nav items %}

Classes and states

Classes for side navigation
ClassWhat it does
.ggds-side-navThe pages of one section, beside its content.
.ggds-side-nav__listThe list of pages.
.ggds-side-nav__list--subThe pages under the current one, indented.
.ggds-side-nav__linkA page. The current page has aria-current="page" and a line beside it.

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 side navigation
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 side navigation, 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

  • Layout

    Classes that arrange content on a page: stacks, rows that wrap, grids and a side column, with the GGDS spacing, text sizes and colours.

  • Breadcrumbs

    A trail of links showing where the page sits in the website.

  • Contents list

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

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.