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

Page structure

Skip link

A "Skip to main content" link that appears when someone presses Tab.

When to use

  • On every page. Without it, keyboard users must Tab through the banner, header and menu on every page before reaching the content (WCAG 2.4.1).

When not to use

  • Pointing anywhere other than the main content.
  • More than once on a page.

How to use

  • Make it the first element in <body>, before the banner.
  • Point it at your main content: <main id="main" tabindex="-1">. The tabindex="-1" lets focus move to <main>, so the next Tab starts from the content, not from the top of the page.
  • Keep the words "Skip to main content".
  • Give <main> the class ggds-main. It removes the focus outline from <main> itself.
  • Check it on every page template: load the page, press Tab once, then Enter.

Do

  • Use the same skip link on every page.

Don't

  • Hide it with display: none; keyboard and screen reader users could not reach it.
  • Put the id="main" on more than one element.

Accessibility

What GGDS does

  • It is moved off screen, not hidden, so it stays in the Tab order and screen readers can always find it.
  • When it has focus it appears at the top left, above everything else, in bold dark text on gold.

What you need to do

  • Make it the first element in <body>.
  • Point it at <main id="main" tabindex="-1">, so focus really moves past the banner and menu.
  • Test it with a keyboard after any change to the page layout.

Example: Skip link (press Tab)

Open this example on its own page

HTML code for “Skip link (press Tab)”
HTML
<a class="ggds-skip-link" href="#main">Skip to main content</a>
<main class="ggds-main ggds-container" id="main" tabindex="-1">
  <p>Press Tab to show the skip link, then Enter to move to the main content.</p>
</main>
JSX (React)
<>
  <a className="ggds-skip-link" href="#main">Skip to main content</a>
  <main className="ggds-main ggds-container" id="main" tabIndex={-1}>
    <p>Press Tab to show the skip link, then Enter to move to the main content.</p>
  </main>
</>

Use it

Stylesheet
ggds.css includes it. To load only the parts you use: core.css, then components/skip-link.css (0.3 KB with gzip, minified).
JavaScript
None needed.

HTML

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

Astro

With @ggds/astro:

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

<SkipLink />

React and Next.js

With @ggds/react:

JavaScript
import { SkipLink } from '@ggds/react';

<SkipLink />

Django

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

Django template
{% ggds_skip_link %}

Classes and states

Classes for skip link
ClassWhat it does
.ggds-skip-linkThe link. Hidden until it has keyboard focus, then shown at the top left of the page.
States of skip link
StateWhat it does
:focusShown on screen while it has focus.

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.

Manual accessibility checks for skip link
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 skip link, newest first
VersionChange
0.2.0Fuller guidance for tags, breadcrumbs, disclosures, the skip link, pagination, rich text, tables and tab links.
0.1.0New: @ggds/astro, the page parts as Astro components (skip link, banner, header, hero, footer, tab bar).
0.1.0New: ggds-django, for Django and Django-based CMSs such as Wagtail: the page parts as template tags, a form renderer that turns any Django form into GGDS markup with an error summary and accessible errors, and the GGDS styles, themes and script as static files.
0.1.0Added.

Every change, in What’s new

  • Page template

    How the parts of a page fit together, in the same order on every government website.

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.