Skip to content

Accessibility

The banners are built with plain, semantic markup and aim to work with keyboard, screen readers, and reduced-motion preferences out of the box.

  • The root is a div with role="dialog", aria-live="polite", and aria-label="Cookie consent".
  • Actions are real <button type="button"> elements — no clickable divs.
  • The title is an <h2> and the description is regular text, so screen readers announce the prompt before the actions.

Consumer-triggered updates (accept/reject) set the consent state and remove the banner; because it is aria-live="polite", assistive tech is not interrupted mid-utterance.

Buttons are reachable with Tab and activated with Enter/Space. Focus is never trapped, so a user can leave the banner and continue through the page.

Buttons show a visible focus ring driven by the global --vsc-state-focus:

.vsc-react-btn:focus-visible {
box-shadow: 0 0 0 0.1875rem var(--vsc-state-focus);
}

Keep a non-transparent --vsc-state-focus so the ring stays visible. It uses light-dark() so it adapts to the active color-scheme.

Transitions are disabled when the user prefers reduced motion. --vsc-state-transition becomes 0ms under prefers-reduced-motion: reduce, and every component transition reads that token.

Text and action colors come from each skin’s tokens. If you override them, keep sufficient contrast between <prefix>color-text / <prefix>color-text-muted and <prefix>color-surface, and between <prefix>color-accent-contrast and <prefix>color-accent (for example --vsc-min-color-text on the Minimalist skin).

All visible strings are props (title, description, acceptLabel, rejectLabel) on the React banners, and attributes (title, description, accept-label, reject-label) on the Web Components — translate them per locale. The only built-in English string is the aria-label="Cookie consent" on the dialog.

Storybook ships @storybook/addon-a11y, so every story shows an accessibility panel. Run pnpm storybook and open the Accessibility tab to spot issues per skin.