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.
Semantics
Section titled “Semantics”- The root is a
divwithrole="dialog",aria-live="polite", andaria-label="Cookie consent". - Actions are real
<button type="button">elements — no clickabledivs. - 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.
Keyboard
Section titled “Keyboard”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.
Focus visibility
Section titled “Focus visibility”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.
Reduced motion
Section titled “Reduced motion”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.
Color contrast
Section titled “Color contrast”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).
Internationalization
Section titled “Internationalization”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.
Testing
Section titled “Testing”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.