Carousel
One piece of evidence at a time, on the home page. It is the one place on the site where something can move by itself, so it follows strict rules.
It has no boxed example: it is part of the home page, and its checks run there.
When to use it
- A handful of things of the same kind, each worth a look, where one at a time reads better than a wall of them.
- Nothing in it is needed to use the page: every slide's story is also on a page of its own.
Use something else when:
- People need to compare the items: a grid of cards.
- It is a set of photographs: a gallery.
- There is one thing to say: say it, with no carousel round it.
How it works
- A callout panel (it stays light in dark mode) holding one slide per case study: words on one side, a small live mock-up on the other.
- Previous and Next buttons, a play button, and a row of dots, one per slide, each named for its case study. The dot for the slide showing is wider and takes the accent colour.
- Slides that aren't showing can't be reached: their links are taken out of the Tab order and they are hidden from screen readers.
- A press of Previous, Next or a dot says the new slide to a screen reader ("Spotlight.me…, 2 of 9"). While it plays by itself it says nothing.
- On touch screens a sideways swipe steps to the next or previous slide, like the buttons. Mouse drags do nothing, so on a computer the text can be selected and nothing moves under the pointer.
- In print, every slide is printed one under the other.
Moving by itself
- Autoplay is a site setting (off on this site) and only starts when the carousel is on screen. The play button is always there.
- As soon as the pointer moves over it or keyboard focus enters it, autoplay stops and stays stopped for the rest of the visit.
- With reduced motion switched on it never moves by itself, and a slide changes at once, with no slide across.
Do and don't
Do
- Keep slides to a similar length, so the panel doesn't jump
- Give every slide a link to the whole story
- Leave autoplay off unless there is a reason for it
Don't
- Put anything in a slide that exists nowhere else
- Use one for a single item, or for more than about ten
- Start it moving while someone is reading it
Accessibility
What it does for you
- A region named "Case study evidence", described as a carousel; each slide is a group described as a slide and named "2 of 9".
- Only the slide showing can be reached: the others are hidden from screen readers and their links are out of the Tab order.
- The dots are plain buttons in a group named "Choose a case study", each named for its case study and its place; the one showing is marked current.
- A press of Previous, Next or a dot says the new slide through a status line. Playing by itself says nothing.
- It moves by itself only if the site asks for it, only when on screen, never with reduced motion, and stops for good when the pointer or the keyboard comes to it.
- The play button’s name is what a press will do: "Play the slides", then "Pause the slides". It has no pressed state as well.
What you need to do
- Every slide’s story is on a page of its own too, and the slide links to it.
- Slides of a similar length (the build warns outside 200 to 290 characters), so the panel doesn’t jump as it changes.
- If you turn autoplay on, look at it with the reader in mind: six seconds is the default, and it can be too short for a slow reader.
Keyboard
| Key | What it does |
|---|---|
| Tab | The slide’s link, Previous, Next, Play, then each dot. |
| Enter or Space | Presses the button with the focus. The focus stays on it. |
What a screen reader is told
- "Case study evidence, carousel".
- Each slide as "2 of 9, slide", then its heading and words.
- After a press: the new slide’s heading and its place.
- Each dot by its case study’s name; the one showing as current.
This is what the browser reports to assistive technology. What each screen reader then says varies, and has not been listened to yet.
WCAG 2.2
| Criterion | Level | How this meets it |
|---|---|---|
| 2.2.2 Pause, Stop, Hide | A | A play and pause button is always there; anything that moves it also stops it. |
| 2.1.1 Keyboard | A | Every control is a button. The swipe has buttons that do the same. |
| 2.5.1 Pointer Gestures | A | A swipe is never the only way: Previous and Next do the same. |
| 2.5.8 Target Size (Minimum) | AA | Arrows and play 44px; each dot’s target 36px. |
| 2.3.3 Animation from Interactions | AAA | With reduced motion a slide changes at once and nothing plays by itself. |
| 4.1.3 Status Messages | AA | The new slide is said through a status line, without moving the focus. |
| 4.1.2 Name, Role, Value | A | The dots are buttons with names, the current one marked. |
The criteria this component has a part in. A page that uses it still has to meet the rest.
Checked
| Check | How | Result |
|---|---|---|
| Automated (axe-core) | WCAG 2.0, 2.1 and 2.2 rules at A and AA, the page in light and in dark | Passed Nothing found, light or dark |
| Narrow screen | No sideways scrolling at 320px wide (WCAG 1.4.10) | Passed No sideways scrolling |
| Keyboard and what the browser reports | Real key presses on the live example, and the role, name and state given to assistive technology | Passed 12 of 12 checks pass |
| On paper | Somnia’s print check: no overlaps, stranded headings or controls on the page | Passed No faults on 6 sheets |
| Screen reader | Listened to by a person, in VoiceOver and NVDA | Not yet Not yet checked by a person |
The 12 checks made with the keyboard, on the example at the top of this page:
- Passed It is a region named "Case study evidence", described as a carousel; each slide is a group named for its place
- Passed Tab goes through the slide’s link, Previous, Next, Play, then the dots
- Passed Only the slide showing can be reached or read: the rest are hidden and their links out of the Tab order
- Passed Enter on Next shows the next slide and says so; the focus stays on Next
- Passed Previous from the first slide goes round to the last
- Passed Each dot is a button named for its case study and its place; the one showing is marked current
- Passed Enter on a dot shows its slide and marks the dot current
- Passed The play button’s name says what a press will do, and it has no pressed state as well
- Passed Playing by itself stops as soon as the keyboard moves on inside it
- Passed On this site it does not move by itself: after seven seconds the first slide still shows
- Passed The arrows and the play button are 44px; each dot is a target of at least 24px
- Passed With reduced motion a slide changes at once
Run by script on against Somnia DS 1.89.0, in Chromium with axe-core 4.14.0. How these checks work, and every component's results.
Not yet checked
- How it sounds in a screen reader (VoiceOver, NVDA, TalkBack) has not been checked by a person. The roles, names and states the browser reports are checked by script; what is actually spoken is not.
- Windows high contrast (forced colours) has not been looked at by a person.
- Whether six seconds a slide is long enough to read one, with autoplay on, has not been tested with anyone. Autoplay is off on this site.
- The dots sit after the slide in the Tab order, so a keyboard reaches Play only after the slide’s link. The ARIA practices put the rotation control first. Not changed, because autoplay stops the moment the focus arrives.
Evidence
Where it's used
| Where | For |
|---|---|
| mediadreams.co.uk | The home page: one slide per case study, in the order the site’s settings give. |
What we saw, and what changed
| When | What we saw | What changed |
|---|---|---|
| The dots’ targets were under 24px. | They grew to 24px (1.1.0), then 36px with 44px arrows and play (1.6.0). | |
| The controls kept to one line. | They wrap onto a second (1.5.0). | |
| A drag with the mouse counted as a swipe. | Swiping works on touch screens only, so on a computer the words can be selected (1.8.0). | |
| The dots were tabs named "1 of 9": nine stops for the keyboard that promised arrow keys and had none, and said nothing of where each led. | They are buttons named for their case studies (1.88.0). | |
| The play button changed its name and its pressed state together: "Play automatic advance, pressed". | Its name alone says what a press will do (1.88.0). | |
| A slide slid across even with reduced motion on. | It changes at once (1.88.0). |
From building and using it on real sites, each entry taken from the changelog or the build's own notes. This is observation by the studio and its clients, not research sessions with users.
What it rests on
- ARIA Authoring Practices: Carousel: A carousel that rotates must have a control to stop it, stop when the keyboard or pointer is on it, and not announce slides while it rotates.
What we don't know yet
- Which slides people read, and how far along the row they get, is not counted.
- It is in the home page’s own code, so no other site has one and nothing here has been tried on another brand.
Status
Beta: it still lives in the home page's own code (sites/mediadreams/src/pages/index.astro), with the slide mock-ups in CaseWidget. It becomes a component in Somnia when a second site needs one.