# Cookie Banner Accessibility: Keyboard and Focus

Source: https://allyway.ai/glossary/cookie-banner-accessibility

Cookie banner accessibility means that the consent banner shown on a website can be perceived and operated by everyone: all its buttons and switches work with a keyboard, focus reaches it and is not hidden behind it, its text is readable and its controls have names. Its core rule is WCAG 2.1.1 Keyboard at Level A.

Cookie banner accessibility decides whether a visitor can use your website at all. The consent banner is often the first thing on screen and sometimes covers the whole page – if its "Accept" or "Reject" button only reacts to a mouse, keyboard and screen reader users are stuck before they see a single product. Because the banner appears on every page, one broken banner is a barrier across the entire website.

## What it means

The banner is part of your page, so the same WCAG rules apply as to any other content. The most important is [WCAG 2.1.1 Keyboard](https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html) (Level A): "All functionality of the content is operable through a keyboard interface" without requiring specific timings for individual keystrokes. Accepting, rejecting, opening the settings and toggling categories are all functionality – so all of it must work without a mouse.

Typical banner problems and the criteria behind them:

| Problem | Criterion | Level |
|---|---|---|
| Buttons are `div` elements that only react to clicks | 2.1.1 Keyboard | A |
| Focus stays on the page behind a banner that blocks it | 2.4.3 Focus Order | A |
| A sticky banner covers the element that has focus | 2.4.11 Focus Not Obscured (Minimum) | AA |
| Light gray text or buttons on white | 1.4.3 Contrast (Minimum) | AA |
| Toggles without a name or state for screen readers | 4.1.2 Name, Role, Value | A |
| Banner breaks or hides buttons when zoomed | 1.4.10 Reflow | AA |

W3C names relying only on pointer event handlers as failure F54 for 2.1.1. A banner that blocks the page until a choice is made behaves like a modal – see [accessible modal dialog](https://allyway.ai/glossary/accessible-modal-dialog) for how focus should move into it and stay there.

> **Note:** > **The banner is often the first barrier**
> When a scanner or a user cannot get past the banner, every other part of the website becomes unreachable. Test the banner first, on a page you have not visited yet.

## Examples

A non-blocking banner placed at the start of the page, built from native buttons:

```html title="Example"
<section aria-labelledby="cc-title" class="cookie-banner">
  <h2 id="cc-title">Cookies on this website</h2>
  <p>We use cookies for statistics and marketing.
     You can accept them, reject them or choose.</p>
  <button type="button">Accept all</button>
  <button type="button">Reject all</button>
  <button type="button" aria-expanded="false" aria-controls="cc-settings">
    Settings
  </button>
  <div id="cc-settings" hidden>
    <input type="checkbox" id="cc-stats">
    <label for="cc-stats">Statistics</label>
  </div>
</section>
```

Native `button` and `input` elements work with Tab, Enter and Space by default. The heading gives the region a name, `aria-expanded` tells screen readers whether the settings are open, and each checkbox has a label. Placing the banner early in the HTML means keyboard users reach it first, in line with [keyboard navigation](https://allyway.ai/glossary/keyboard-navigation).

**Do:** Do

Use real buttons and checkboxes, put the banner first in the focus order, give it a heading, keep enough [color contrast](https://allyway.ai/glossary/color-contrast), make sure it never hides the focused element, and let the settings be closed again by keyboard.

**Don't:** Don't

Build buttons from `div` or `span` with only click handlers, show the banner at the end of the HTML while it blocks the top of the screen, hide reject options behind mouse-only links, or use toggles without names.

## How to check cookie banner accessibility



## Questions

Q: What makes a cookie banner accessible?
A: All buttons and switches work by keyboard, focus reaches the banner first and is not hidden behind it, the text has enough contrast, every control has a name and the banner stays usable when zoomed. Then everyone can make a choice.

Q: Which WCAG criteria apply to cookie banners?
A: Mainly 2.1.1 Keyboard, 2.4.3 Focus Order, 4.1.2 Name, Role, Value and 1.4.3 Contrast (Minimum), plus 2.4.11 Focus Not Obscured (Minimum) for sticky banners. The banner is content like any other on the page.

Q: Should a cookie banner be a modal dialog?
A: It can be. If it blocks the page until a choice is made, it should behave like a modal dialog: focus moves into it, stays there and continues on the page after closing. A non-blocking banner should come first in the focus order instead.

Q: Are cookie banners covered by the European Accessibility Act?
A: The [European Accessibility Act](https://allyway.ai/regulations/eaa) covers websites of many products and services and refers to EN 301 549, which takes over WCAG Level AA. The cookie banner is part of those pages, so it falls under the same rules.

Q: How do I check my banner's contrast?
A: Enter the text and background color of the banner and its buttons into a contrast tool. The free [contrast checker](https://allyway.ai/free-wcag-contrast-checker) shows right away whether the colors pass the WCAG ratios.
