How accessible is your website?Start free check
WCAG 2.1.1Level AOperable

Cookie Banner Accessibility: Keyboard and Focus

Also called: Accessible cookie banner, Accessible consent banner, Cookie consent accessibility

Definition

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 (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 for how focus should move into it and stay there.

Examples

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

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.

Do

Use real buttons and checkboxes, put the banner first in the focus order, give it a heading, keep enough color contrast, make sure it never hides the focused element, and let the settings be closed again by keyboard.

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.

    Questions

    What makes a cookie banner accessible?

    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.

    Which WCAG criteria apply to cookie banners?

    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.

    Should a cookie banner be a modal dialog?

    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.

    Are cookie banners covered by the European Accessibility Act?

    The European Accessibility Act 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.

    How do I check my banner's contrast?

    Enter the text and background color of the banner and its buttons into a contrast tool. The free contrast checker shows right away whether the colors pass the WCAG ratios.

    • Keyboard Navigation: WCAG 2.1.1 Explained

      Keyboard navigation means that every function of a website can be reached and operated with a keyboard alone – usually with Tab, Shift+Tab, Enter, Space and the arrow keys. WCAG 2.1.1 requires it at Level A.

      Read definition: Keyboard Navigation: WCAG 2.1.1 Explained
    • Accessible Modal Dialog: Focus, Escape and ARIA

      An accessible modal dialog is a pop-up window that keyboard and screen reader users can use like everyone else: focus moves into it when it opens, the page behind it is inert, Escape closes it and focus returns to the control that opened it. Its focus handling falls under WCAG 2.4.3 Focus Order at Level A.

      Read definition: Accessible Modal Dialog: Focus, Escape and ARIA
    • Focus Not Obscured: Keep the Focused Item Visible

      Focus Not Obscured (Minimum) is WCAG success criterion 2.4.11. When a user interface component receives keyboard focus, it is not entirely hidden due to author-created content such as sticky headers, footers or non-modal dialogs.

      Read definition: Focus Not Obscured: Keep the Focused Item Visible
    • Color Contrast: WCAG Ratios and How to Check Them

      Color contrast is the difference in brightness between text or interface elements and their background, measured as a ratio from 1:1 to 21:1. WCAG requires at least 4.5:1 for normal text and 3:1 for large text.

      Read definition: Color Contrast: WCAG Ratios and How to Check Them

    Let AI Handle Website Accessibility

    Built in Europe. Set up in 2 minutes, no developer needed. Put website accessibility on autopilot with AI-powered fixes and automated monitoring.

    1. 1Choose your plan
    2. 2Install in 2 min
    3. 3AI fixes your website
    4. Done