Accessibility

How the pill and the Island are named, announced and focused, and what is tested and what stays with you.

On this page

The pill

The collapsed stack is one native <button>. Its accessible name comes from labels.stackSummary(title, count, missed): the title of the top notification, how many notifications are in the stack and how many were missed, such as "Synced to the cloud, 3 notifications, 1 missed". It has aria-expanded="false" and controls the Island. The tails and the badge are decorative and hidden from assistive technology; the count they show is already part of the name.

The host around it is a region named by labels.region. It is not in the tab order, but it is the anchor that requestFocus() moves focus to.

The Island

Activating the pill opens the Island in place of it. The Island is a region with the role description "carousel", named by labels.island and described by a hidden hint, labels.collapse. Every label and its English default is in Labels & announcements.

  • Only the current notification is in the DOM, as a group with the role description "slide", named by labels.page(index, total).
  • Its title is a heading. Opening the Island from the keyboard moves focus to it.
  • Close, actions, retry and cancel are native buttons and links. Close is 32px wide with a 44px touch target.
  • With more than one notification, page dots appear: buttons named like the slides, with aria-current on the current one. Above five notifications a text counter replaces them; it is hidden from assistive technology, because the slide's name already says where you are.
  • With more than one notification, a clear button ends the dots row, named labels.clearAll. Its first press only arms it: its name becomes labels.clearAllConfirm(count), spoken once through a status. After the second press focus returns to where it was before the Island. Leaving the button, collapsing the Island or waiting disarms it; a double click never does both presses.
  • Missed notifications appear as a line, labels.overflowCount(count), with a button named labels.acknowledgeOverflow.
  • A notification with progress exposes a progressbar in the Island, named by its progress label or its title.
  • While a guide holds the Island, such as a tour, the Island is a region named by the guide's label: F6 and Tab reach it, ← → press its back and next buttons and Escape dismisses it. Its keys are in Focus and keyboard.

Keyboard and gestures

InputResult
TabReaches the pill like any other button. In the Island, from the title: the body when its text scrolls, the actions, close, the dots, the clear button, then the overflow button.
Enter or Space on the pillOpens the Island and moves focus to the title.
← →Previous and next notification; mirrored when dir="rtl".
Home EndNewest and oldest notification. On a focused body that scrolls, its top and bottom instead.
EscapeCollapses the Island and returns focus to the pill.
Enter on closeCloses the current notification. Focus stays on close, now for the next one; after the last, it returns to where it was before the stack.
Horizontal swipe on the pillDismisses the top notification.
Horizontal swipe in the IslandMoves between notifications, like the arrow keys.
Vertical swipe on the Island's header towards the edgeCollapses the Island, like Escape.

Every gesture has a key or a button that does the same. Vertical movement on the pill, the body and the page always scrolls natively, and a swipe never starts on a button or a link.

Announcements

Two permanent live regions, one polite and one assertive, sit next to the host from the moment it mounts. Cloudlet collects what happened in 300ms windows and speaks each window once:

  • A new notification is announced by its title and description. A rich description is not read from its markup; it carries its own announcement text.
  • Notifications behind the presented one are announced only as a count.
  • A repeated notification merged by dedupeKey announces its occurrences.
  • Progress updates are silent; the end of an operation is announced once.
  • Moving back to a notification already shown in the open Island (arrow keys, the dots, a swipe, or the next one after closing) reads it again, once. The title stays the same element across slides, so a screen reader would otherwise hear nothing.
  • Reflow or remounting the Toaster repeats nothing. Returning to a hidden tab announces the current count, not the events that were missed.

Urgency is explicit. Every notification is polite unless you set announcementPriority; error alone does not interrupt. Use assertive for what the user must hear right now, and off for notifications that only confirm what the interface already shows:

announcements.ts
import { createCloudlet } from '@cloudlet/toast';

const cloudlet = createCloudlet();

// Interrupts the screen reader: the user is about to lose work.
cloudlet.show({
  title: 'Connection lost: changes are not saved',
  kind: 'error',
  announcementPriority: 'assertive',
});

// The list already shows the new item; speaking it again would be noise.
cloudlet.show({ title: 'Cloud added to the forecast', kind: 'success', announcementPriority: 'off' });

Focus

Cloudlet never takes focus on its own:

  • A new notification arriving, and the Island opening for attention, leave focus where it is.
  • Focus enters the stack only when the user moves it there: with Tab, a click, or a shortcut your application provides.
  • When a focused control disappears, focus moves before it is hidden: to the title after retry or cancel, otherwise as in Keyboard and gestures (close of the next notification, the pill on Escape, the element focused before the stack after the last one).

While a notification has focus or the pointer, its time on screen is paused, so it cannot close while someone is reading or operating it. See Time on screen.

Moving focus on request

requestFocus(target?) moves focus into the stack when the user asks for it, for example from a keyboard shortcut. Its targets and results are in the reference:

shortcut.ts
import { createCloudlet } from '@cloudlet/toast';

const cloudlet = createCloudlet();

// Alt+N: jump to the notifications. Tab then reaches the pill.
document.addEventListener('keydown', (event) => {
  if (event.altKey && event.code === 'KeyN') {
    event.preventDefault();
    cloudlet.requestFocus();
  }
});

Do not call it when a notification arrives: that is the move the focus policy forbids.

Reduced motion

Under prefers-reduced-motion, every transition of the stack and the Island becomes a short crossfade: no movement, no scaling, no slide. Spinners stop and swipes are turned off; the keyboard and the buttons still do everything. Cloudlet follows the setting live, without a remount, and marks the host with data-reduced-motion="true".

An app with its own motion setting can ask for the same calm. Pass reducedMotion to the Toaster, or put data-reduced-motion on any ancestor of it (it counts by presence, with any value). One attribute on <html> calms every Cloudlet component on the page. The system setting and the app's setting add up: either one is enough, and the app cannot turn motion on against prefers-reduced-motion: reduce. Changes apply live, without a remount.

app.tsx
import { Toaster } from "@cloudlet/toast";

export function AppToaster({ reduceMotion }: { reduceMotion: boolean }) {
  return <Toaster reducedMotion={reduceMotion} />;
}

In forced-colours mode Cloudlet uses system colours with visible borders and a solid focus ring (Theme).

Localization

Everything Cloudlet says comes from three partial objects; whatever you leave out keeps its English default:

  • labels on the Toaster: names of the controls and regions.
  • announcements on the Toaster: the text spoken in the live regions.
  • messages of the controller: titles of fallback notifications, such as an operation that failed without a mapped error.

A string or a formatter per key:

notifications.tsx
import { CloudletProvider, createCloudlet, Toaster } from '@cloudlet/toast';

const cloudlet = createCloudlet({ messages: { operationError: 'Échec' } });

export function Notifications() {
  return (
    <CloudletProvider controller={cloudlet}>
      <Toaster
        labels={{ close: 'Fermer la notification', page: (index, total) => `${index} sur ${total}` }}
        announcements={{ queued: (count) => `${count} notifications en attente` }}
      />
    </CloudletProvider>
  );
}

A formatter that throws or returns an empty string falls back to the default and is reported to onDiagnostic. Every key, and a complete translation, is in Labels & announcements.

What is tested

Cloudlet's accessibility suite runs on production builds under the strict CSP of Content Security Policy, in Playwright with Chromium, Firefox and WebKit:

  • focus order, Escape, focus after close, retry, cancel and actions, and that arrival and auto-opening never move focus;
  • the live regions: what is said, when, once, and that progress stays silent;
  • 320px viewports with 200% text and right-to-left content, without horizontal page scrolling and with 44px targets;
  • axe (WCAG 2.x rules) on the stack, the Island, overflow, right-to-left and the dark theme, with no violations;
  • forced colours and reduced motion, emulated, and touch gestures on emulated phones.

Automation checks the DOM, not speech, so the rest is checked by hand:

  • screen readers: VoiceOver on macOS and iOS, NVDA on Windows and TalkBack on Android;
  • physical iOS and Android phones: touch gestures, the operating-system keyboard and pinch zoom;
  • real Windows High Contrast;
  • the minimum browser versions from Requirements.

What stays with your application

  • Keep important results in your interface. A notification is a notice and can be missed, dismissed or closed by time. Anything the user must not lose also lives on the page.
  • Translate labels, announcements and messages (Localization), and choose the urgency of each notification (Announcements).
  • Keep rich content simple: text and inline formatting with its own announcement. Controls belong in action, text input in a form action, whose fields come labelled and announced.
  • Keep contrast when you override colour tokens: 4.5:1 for text and 3:1 for the focus ring against the surface.
  • Test with the screen readers your users have. Delivery to a live region does not prove that it was spoken.