Progress bar
How far something has got: an upload, a conversion. When the amount isn't known yet, it shows that work is under way.
Show code
<div class="sn-progress" role="progressbar" aria-label="Uploading IMG_4621.mp4"
aria-valuemin="0" aria-valuemax="100" aria-valuenow="68"><span style="width:68%"></span></div>
<!-- No amount known yet -->
<div class="sn-progress is-busy" role="progressbar" aria-label="Getting it ready"><span></span></div> When to use it
- Something takes more than a second and the person is waiting on it: an upload, a conversion.
- You know how far it has got, or will soon.
Use something else when:
- A page or a list is loading: loading placeholders.
- It is done in under a second: show nothing.
- Claude is thinking: the Suggest button says so itself.
How it works
- Put the words beside it: what is happening, and the figure ("uploading… 68%"). The bar is the glance, the words are the meaning.
- Use the moving bar (
is-busy) only until an amount is known, then switch to the real figure. - For anything under a second, show nothing. For a page or a list that is loading, use loading placeholders.
Motion
The fill eases to each new width over 250 ms, so steps read as movement. The moving bar crosses every 1.4 seconds. With reduced motion the fill jumps and the moving bar becomes a still, striped one.
Accessibility
What it does for you
- A progress bar to a screen reader, with a name and, when it is known, how far it has got.
- When the amount isn’t known it says only that work is under way.
- The fill has at least 3:1 against its track, in light and dark.
- With reduced motion the fill jumps to each new width and the moving bar becomes a still, striped one.
What you need to do
- Words beside it saying what is happening and the figure: the bar is the glance, the words the meaning.
- Announce the stages ("uploading", "added"), never every step of the figure.
- A name in
aria-labelthat says what is being done.
Keyboard
| Key | What it does |
|---|---|
| Tab | Nothing: it is not a control. |
What a screen reader is told
- "Progress bar", its name, and its value when there is one.
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 |
|---|---|---|
| 1.1.1 Non-text Content | A | The bar has a name in words. |
| 1.4.11 Non-text Contrast | AA | The fill against the track. |
| 2.3.3 Animation from Interactions | AAA | The movement stops with reduced motion. |
| 4.1.2 Name, Role, Value | A | Role, name and value. |
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 5 of 5 checks pass |
| On paper | Somnia’s print check: no overlaps, stranded headings or controls on the page | Passed No faults on 4 sheets |
| Screen reader | Listened to by a person, in VoiceOver and NVDA | Not yet Not yet checked by a person |
The 5 checks made with the keyboard, on the example at the top of this page:
- Passed The browser reports a progress bar with a name and how far it has got
- Passed When the amount isn’t known it has a name and no value
- Passed The fill has at least 3:1 against its track, in light and dark
- Passed It is not a stop for the keyboard
- Passed With reduced motion nothing moves: the fill jumps and the moving bar is still
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.
- How often a screen reader says the value as it changes is the reader’s own business, and differs between them.
Evidence
Where it's used
| Where | For |
|---|---|
| Somnia CMS | Each file being added to the media library: its figure, its words and the bar. |
What we saw, and what changed
| When | What we saw | What changed |
|---|---|---|
| A file being added showed how far it had got in words and a figure only. | A progress bar on each file’s card (1.75.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 we don't know yet
- It has only been used for uploads and conversions, which take seconds. Nothing longer has tried it.