Skip to content

Accessibility

A loader is a status message: users of assistive technologies hear that something is loading without losing their place. When progress can be measured, it also follows the progressbar role. There is no dedicated WAI-ARIA APG pattern. Handled this way, it meets WCAG 2.1 AA.

  • Show the label whenever possible: it is the primary source of context, and the icon and gradient must never be needed to understand the loading state. Source: WCAG 1.4.1 Use of Color.
  • Keep the label readable against its surface. Source: WCAG 1.4.3 Contrast (Minimum).
  • When the label is hidden, the ring alone carries the loading state, so it needs enough contrast against its surface. Source: WCAG 1.4.11 Non-text Contrast.
  • Let the label wrap rather than truncate, so it survives text resizing and zoom. Source: WCAG 1.4.4 Resize Text.

Say that loading started, keep saying it consistently while it runs, and say when it finished. The label comes before the action button in the DOM, so it is read first. Source: WCAG 1.3.2 Meaningful Sequence.

The action button is a native <button> and keeps its keyboard behaviour. Source: WCAG 2.1.1 Keyboard.

The sweep stops under prefers-reduced-motion, and the static arc still reads as loading.

Status

role="status" on tng-loader-status announces the label politely. A live region only announces changes made after it is in the DOM, so render it with an empty label and set the text afterwards. Source: WCAG 4.1.3 Status Messages.

Indeterminate ring

No role and no name: the label carries the meaning, and the ring is decorative. A label hidden with sr-only stays announced.

Determinate ring

role="progressbar", named by the label through aria-labelledby, with aria-valuemin, aria-valuemax and aria-valuenow. Value changes aren’t announced by themselves, so update the label at meaningful milestones. Source: WCAG 4.1.2 Name, Role, Value.

Icon

aria-hidden="true". It is decorative and must not be announced.

Action button

Named by its visible text, which should say what it does: “Retry”, “Cancel loading”.

Loading region

aria-busy="true" on the region being filled while the loader shows. Removing the loader is silent, so when it goes, drop aria-busy and announce completion from a role="status" region that outlives it, for example “Search results loaded”.

Source: WCAG 4.1.2 Name, Role, Value.