Skip to content

Accessibility

The banner must meet WCAG 2.1 AA. Low contrast or hidden focus rings not only harm users — they can undermine informed consent, linking accessibility failures to GDPR validity.

GDPR Article 7 requires consent to be freely given, specific, informed, and unambiguous. A banner that screen reader users cannot operate, or that keyboard users cannot tab through, may not produce legally valid consent. Regulators (ICO, CNIL) have noted that inaccessible consent mechanisms are suspect.

Focus indicators must use outline, not box-shadow. Using box-shadow for focus rings can be clipped by overflow: hidden on ancestor elements inside the Shadow DOM.

Correct:

Correct focus ring
.ag-btn:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 2px;
}

Incorrect — box-shadow is clipped by overflow:

Incorrect — avoid
/* hypothetical example */
.some-selector:focus-visible {
box-shadow: 0 0 0 3px var(--accent); /* clipped by parent overflow:hidden */
}

The default banner styles use outline for all interactive focus states. If you override focus styles, always use outline.

Text typeMinimum ratioExample
Body text (< 18px, not bold)4.5:1.ag-desc text vs background
Large text (≥ 18px or ≥ 14px bold)3:1.ag-title text vs background
UI components (button borders)3:1.ag-btn border vs background

Respect users who request reduced motion. Kookiok’s default animation tokens can be overridden:

Respect prefers-reduced-motion
@media (prefers-reduced-motion: reduce) {
:host {
--animation: none;
}
.ag-banner {
animation: none !important;
transition: none !important;
}
}

The banner is fully keyboard-navigable by default:

  • Tab cycles through interactive elements in DOM order.
  • Enter / Space activates buttons and toggles.
  • The banner takes focus when it opens, on Reject all where it is shown.
  • Focus is trapped inside the dialog while the banner is open (aria-modal="true"). With “Dim the page behind the banner” switched off, or while the banner is folded, it is not (aria-modal="false"): Tab moves on to the page.
  • Escape never accepts. On a first view it refuses, as Reject all does; on a banner reopened over a decision it closes it and keeps the decision. Where focus is not trapped, it decides nothing on a first view.

Do not use CSS to reorder visual display without matching DOM order — order property creates a mismatch between visual and focus sequence.

The banner uses semantic ARIA:

  • role="dialog" with aria-modal on .ag-banner: "true", or "false" while the page under the banner can be used
  • aria-labelledby pointing to .ag-title
  • aria-describedby pointing to .ag-desc
  • Toggle buttons in .ag-bar-cats have aria-pressed state
  • The detail panel uses aria-hidden to suppress it from the accessibility tree when collapsed

Do not remove display: block from collapsed sections with CSS visibility: hidden — use the existing aria-hidden mechanism.

If your site uses right-to-left text (dir="rtl"), the banner inherits direction from the host document. Test that your token overrides (e.g., --font-family) include RTL-appropriate fonts.

  • --surface-text vs --surface contrast ≥ 4.5:1 (verify with DevTools)
  • --btn-fill vs --btn-text contrast ≥ 4.5:1
  • All buttons maintain min-height: 44px
  • Focus rings use outline not box-shadow
  • @media (prefers-reduced-motion) override applied
  • Banner tested with keyboard-only navigation
  • Banner tested with VoiceOver / NVDA screen reader