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

Content

Scroll effects

Parts that rise into view, layers with depth, lines that draw themselves, and scenes that tell a story as people scroll. With no script, and still for anyone who asks for less motion.

When to use

  • On a homepage, a campaign or an information page, to make the page feel alive and to show how things fit together, as the GGDS homepage does.

When not to use

  • Inside a service's steps: questions, check your answers, errors, payment and confirmation. People finishing a task need a still page. A GGDS test checks that no form component or pattern uses these classes.
  • To hide content until people scroll to it, or to make them wait. The words must be there and readable without the movement.
  • On text people read for long. Move pictures, cards and headings, not paragraphs.

How to use

  • Add a class to the part that should move: ggds-reveal on a heading or card, ggds-stagger on a list or grid, ggds-parallax on a picture behind the text, ggds-draw on an SVG drawing (give each path pathLength="1").
  • To tell a story, use a scene: a <section class="ggds-scene ggds-scene--pinned"> holding one ggds-scene__stage with the words and a picture. Give each part of the picture ggds-scene__part and its turn, --2 to --6. The scene stays on screen while people scroll, and its parts arrive in order. Put the words first and the picture after them, as the stage's two children.
  • Choose how a part arrives: it rises by default, or --fade, --grow, --from-start, --from-end or --draw.
  • Keep it small: a few things moving at once, never the whole page.

Accessibility

What GGDS does

  • Nothing moves for people who have asked their device for less motion: they see the finished page (WCAG 2.3.3).
  • Browsers without scroll-driven animations show the same still, finished page. Nothing is ever hidden waiting for an animation.
  • Movement follows the person's own scrolling: nothing plays by itself, and the scroll is never slowed or taken over.
  • Only position, transparency and SVG lines move, so the page never jumps.
  • Cards and list items rise without fading, so their words are at full contrast even when they are only half way on screen. Only pictures and headings fade.
  • A pinned scene stays pinned only on a screen wide and tall enough to hold its words beside its picture. On a phone, at high zoom or on a short screen it is an ordinary section, so nothing is cut off (WCAG 1.4.10). On a phone the picture still builds itself as it rises up the screen, and drifts a little slower than the words, so people never scroll past words that do not move.

What you need to do

  • Write the words so they make sense without the pictures: a scene's heading and text carry its meaning.
  • Give a drawing a text alternative, or hide it from screen readers (aria-hidden="true") when the text already says it all.

Example: Cards that arrive one after another

Open this example on its own page

HTML code for “Cards that arrive one after another”
HTML
<h2 class="ggds-reveal">What you can do</h2>
<p>Scroll down: the cards arrive in turn. With less motion turned on, they are simply there.</p>
<p>Government websites built with GGDS look and work the same way, so people who have used one can use them all. Each institution keeps its own colour, and every part is tested with a keyboard, a screen reader and on a small phone before it is published.</p>
<p>The effects follow your own scrolling. Nothing plays by itself, and the page never jumps.</p>
<ul class="ggds-card-grid ggds-stagger">
  <li class="ggds-card"><h3 class="ggds-card__title"><a class="ggds-card__link" href="#apply">Apply for a licence</a></h3><p class="ggds-card__body">Online, in about 10 minutes.</p></li>
  <li class="ggds-card"><h3 class="ggds-card__title"><a class="ggds-card__link" href="#pay">Pay a fee</a></h3><p class="ggds-card__body">By mobile money or card.</p></li>
  <li class="ggds-card"><h3 class="ggds-card__title"><a class="ggds-card__link" href="#track">Track your application</a></h3><p class="ggds-card__body">With your reference number.</p></li>
</ul>
JSX (React)
<>
  <h2 className="ggds-reveal">What you can do</h2>
  <p>Scroll down: the cards arrive in turn. With less motion turned on, they are simply there.</p>
  <p>Government websites built with GGDS look and work the same way, so people who have used one can use them all. Each institution keeps its own colour, and every part is tested with a keyboard, a screen reader and on a small phone before it is published.</p>
  <p>The effects follow your own scrolling. Nothing plays by itself, and the page never jumps.</p>
  <ul className="ggds-card-grid ggds-stagger">
    <li className="ggds-card"><h3 className="ggds-card__title"><a className="ggds-card__link" href="#apply">Apply for a licence</a></h3><p className="ggds-card__body">Online, in about 10 minutes.</p></li>
    <li className="ggds-card"><h3 className="ggds-card__title"><a className="ggds-card__link" href="#pay">Pay a fee</a></h3><p className="ggds-card__body">By mobile money or card.</p></li>
    <li className="ggds-card"><h3 className="ggds-card__title"><a className="ggds-card__link" href="#track">Track your application</a></h3><p className="ggds-card__body">With your reference number.</p></li>
  </ul>
</>

Example: A scene that stays while its story plays

Open this example on its own page

HTML code for “A scene that stays while its story plays”
HTML
<section class="ggds-scene ggds-scene--pinned" aria-labelledby="scene-title">
  <div class="ggds-scene__stage">
    <h2 id="scene-title">From thread to cloth</h2>
    <p>Scroll: the threads draw themselves, the strips arrive, and the cloth comes together. On a short screen, at high zoom or with less motion, you see the finished cloth.</p>
    <svg viewBox="0 0 320 200" width="320" height="200" aria-hidden="true" focusable="false">
      <path class="ggds-scene__part ggds-scene__part--draw" d="M10 30H310" pathLength="1" fill="none" stroke="#fcd116" stroke-width="6"/>
      <path class="ggds-scene__part ggds-scene__part--draw ggds-scene__part--2" d="M10 50H310" pathLength="1" fill="none" stroke="#ce1126" stroke-width="6"/>
      <rect class="ggds-scene__part ggds-scene__part--from-start ggds-scene__part--3" x="60" y="80" width="60" height="110" fill="#006b3f"/>
      <rect class="ggds-scene__part ggds-scene__part--4" x="130" y="80" width="60" height="110" fill="#fcd116"/>
      <rect class="ggds-scene__part ggds-scene__part--from-end ggds-scene__part--5" x="200" y="80" width="60" height="110" fill="#ce1126"/>
    </svg>
  </div>
</section>
JSX (React)
<section className="ggds-scene ggds-scene--pinned" aria-labelledby="scene-title">
  <div className="ggds-scene__stage">
    <h2 id="scene-title">From thread to cloth</h2>
    <p>Scroll: the threads draw themselves, the strips arrive, and the cloth comes together. On a short screen, at high zoom or with less motion, you see the finished cloth.</p>
    <svg viewBox="0 0 320 200" width="320" height="200" aria-hidden="true" focusable="false">
      <path className="ggds-scene__part ggds-scene__part--draw" d="M10 30H310" pathLength="1" fill="none" stroke="#fcd116" strokeWidth="6" />
      <path className="ggds-scene__part ggds-scene__part--draw ggds-scene__part--2" d="M10 50H310" pathLength="1" fill="none" stroke="#ce1126" strokeWidth="6" />
      <rect className="ggds-scene__part ggds-scene__part--from-start ggds-scene__part--3" x="60" y="80" width="60" height="110" fill="#006b3f" />
      <rect className="ggds-scene__part ggds-scene__part--4" x="130" y="80" width="60" height="110" fill="#fcd116" />
      <rect className="ggds-scene__part ggds-scene__part--from-end ggds-scene__part--5" x="200" y="80" width="60" height="110" fill="#ce1126" />
    </svg>
  </div>
</section>

Use it

Stylesheet
ggds.css includes it. To load only the parts you use: core.css, then components/motion.css (0.9 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

Classes for scroll effects
ClassWhat it does
.ggds-revealRises into place as it comes into view.
.ggds-reveal--fadeFades in instead of rising.
.ggds-reveal--scaleGrows into place instead of rising.
.ggds-staggerOn a list or grid: each child arrives a little after the one before it. It rises without fading, so its words are always at full contrast.
.ggds-parallaxA layer that moves a little against the scroll, for depth.
.ggds-parallax--nearMoves more: a layer that seems closer.
.ggds-parallax--farMoves less: a layer that seems further away.
.ggds-drawOn an SVG: its lines draw themselves as it comes into view. Give each path pathLength="1".
.ggds-sceneA part of the page that tells a story as people scroll. Its parts use its own timeline.
.ggds-scene--pinnedThe scene stays on screen while people scroll through it, and its parts play in order. Only on screens wide and tall enough to hold its words beside its picture; on a phone the picture builds itself as it rises up the screen.
.ggds-scene__stageWhat stays on screen in a pinned scene: the words and the picture.
.ggds-scene__partOne part of the picture, which arrives in its turn: first by default, or --2 to --6 for later turns.
.ggds-scene__part--*How and when it arrives: --fade, --grow, --from-start, --from-end, --draw (an SVG line drawing itself), and its turn, --2 to --6.
States of scroll effects
StateWhat it does
prefers-reduced-motion: reduceNothing moves: the page is still and finished.
no scroll-driven animationsA browser without them shows the still, finished page.

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: “scroll effects: still and fully visible for people who ask for less motion, and play as people scroll otherwise”

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 scroll effects
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 scroll effects, newest first
VersionChange
0.5.0New: scroll effects, played by the browser from the scroll position, with no script: ggds-reveal (rise, fade or grow into view), ggds-stagger (a list's items in turn), ggds-parallax (layers with depth), ggds-draw (SVG lines that draw themselves) and ggds-scene (a story that plays as people scroll, pinned on screen with its parts arriving in order). Still and finished for anyone who asks for less motion and in browsers without scroll-driven animations; a pinned scene is an ordinary section on a short screen or at high zoom, so nothing is cut off. Only position, transparency and SVG lines move, so the page never jumps. Under 2 KB with compression.
0.1.0Added.

Every change, in What’s new

  • Hero

    The top of a homepage, in your institution's colour. It asks visitors what they need.

  • Card

    A box that sums up a page, service or document and links to it.

  • 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.

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.