Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cookie banner not keyboard accessible: how to find and fix it

PRF-344Medium impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

A cookie banner (also called a consent banner) asks visitors to accept or reject cookies. It is not keyboard accessible when someone who uses only a keyboard, a switch device or voice control can't operate it. Typical causes: buttons built from <div> or <a> tags with no keyboard support, a banner added at the very end of the page so Tab reaches it last, a banner that covers the page while focus stays behind it, or a banner with no visible focus outline.

This relates to WCAG 2.2 criteria such as 2.1.1 Keyboard, 2.4.3 Focus Order, 2.4.7 Focus Visible and 2.4.11 Focus Not Obscured. WCAG is the Web Content Accessibility Guidelines, the standard most accessibility laws point to.

Why it costs you leads or sales

People who navigate by keyboard can get stuck behind the banner, unable to reach your form, menu or checkout. They leave. If they can't press Accept, your consent-based tags (analytics, ads) may never fire, so you also lose measurement for those visits. Inaccessible consent controls can also raise legal and compliance risk.

Where a keyboard visitor gets stuck
  1. Land on pageBanner appears over content
  2. Press TabFocus goes to page behind the banner or skips it
  3. Accept or rejectButtons can't be reached or activated
  4. Fill form / checkoutCovered by the banner

The banner can't be operated, so everything after it is lost.

How to check if your site has it

Do this in a private window with cookies cleared, so the banner shows. Put your mouse aside and use only the keyboard.

Keyboard test for your cookie banner
  1. Reload and press Tab

    Watch where the focus outline lands. It should reach the banner within the first few Tab presses, or the banner should take focus when it opens.

  2. Tab through every banner control

    Accept, Reject, Settings, links to the policy and any toggles must all be reachable, each with a clearly visible outline.

  3. Activate with Enter and Space

    Buttons should work with both keys. Toggles should work with Space.

  4. Press Escape and Shift+Tab

    Check you can go backwards and that you are never stuck inside the banner without a way out.

  5. Check what happens after choosing

    The banner should close and focus should move to a sensible place, not vanish into nowhere. The page behind must then be fully usable.

  6. Try a screen reader

    Use NVDA (Windows), VoiceOver (Mac/iOS) or TalkBack (Android). Buttons should be announced as buttons with clear names.

How to fix it

Most banners come from a consent plugin or platform. First check its settings and update it. If it is a custom banner, use the markup below. Never fix this by removing the banner if you need consent.

Fix by platform
  1. Update the consent plugin

    Update your cookie plugin and theme. Accessibility fixes often ship in updates.

  2. Review banner settings

    Look for options for position, overlay and button style. Avoid settings that render the banner as a bare link or image.

  3. Retest with the keyboard

    If the plugin still fails, contact its support with your test results or switch to a plugin that passes.

Accessible cookie banner patternhtml
<div id="cookie-banner" role="region" aria-label="Cookie consent">
  <p id="cookie-text">We use cookies to measure traffic and improve the site. <a href="/privacy">Privacy policy</a></p>
  <button type="button" id="cookie-accept">Accept all</button>
  <button type="button" id="cookie-reject">Reject all</button>
  <button type="button" id="cookie-settings">Cookie settings</button>
</div>
<script>
  var banner = document.getElementById('cookie-banner');
  function closeBanner() {
    banner.hidden = true;
    document.querySelector('main, body').setAttribute('tabindex', '-1');
    (document.querySelector('main') || document.body).focus();
  }
  document.getElementById('cookie-accept').addEventListener('click', closeBanner);
  document.getElementById('cookie-reject').addEventListener('click', closeBanner);
</script>
Visible focus for banner buttonscss
#cookie-banner button:focus-visible,
#cookie-banner a:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
}
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 40vh;
  overflow: auto;
}
Banner before and after

Not accessible

  • Accept is a styled <div> with a click handler
  • Banner is added at the end of the page
  • No visible focus outline
  • Banner covers the form fields

Accessible

  • Accept and Reject are real <button> elements
  • Banner is early in the tab order and labelled
  • Clear focus outline on every control
  • Compact banner, focus moves on after choosing

How to confirm it's fixed

Confirmation checklist
  • Tab reaches every banner control in a logical order
  • Enter and Space activate buttons
  • Focus outline is clearly visible on each control
  • After choosing, the banner closes and focus lands in the page
  • No keyboard trap: Shift+Tab and Tab both still work
  • Screen reader announces each button by name
  • Consent choice is still saved and tags respect it
  • Retested on mobile with an external keyboard or screen reader

How to prevent it happening again

Add the keyboard test to your release checklist, and rerun it after any theme, plugin or consent tool update, or after a redesign. When choosing a consent tool, test its demo with the keyboard before buying. Run an automated accessibility scanner (such as axe or Lighthouse) regularly, but remember scanners can't catch every focus issue, so keep the manual test.

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys (forms, checkouts, booking and chat buttons) on a schedule and checks steps, tracking hits and lead delivery. It does not audit keyboard accessibility. The kind of tool that fits is an accessibility testing tool: an automated scanner such as axe DevTools or Lighthouse for a first pass, plus a manual keyboard and screen reader test, or an accessibility audit by a specialist.

Once your banner is fixed, FunnelGuard can still help with related money-side problems, such as checking that your forms and tracking keep working. You can start with the Free plan (1 site, 2 journeys, daily checks, no card).

Questions people ask

Why is my cookie banner not working with the keyboard?

Usually the buttons are not real <button> elements, or the banner is placed so late in the page that Tab reaches it last. Another common cause is that the focus outline is removed. Switch to real buttons, move the banner earlier in the page and restore a visible focus style.

How do I test if my cookie banner is keyboard accessible?

Open the site in a private window so the banner shows, then use only the keyboard. Press Tab to reach every control, Enter or Space to activate them, and Shift+Tab to go back. You should always see where focus is and never get stuck.

Does a cookie banner need to meet WCAG?

Yes, a cookie banner is part of your page, so WCAG criteria such as Keyboard (2.1.1), Focus Order (2.4.3) and Focus Visible (2.4.7) apply to it. Many accessibility laws refer to WCAG. Check which rules apply in your country.

Should a cookie banner trap keyboard focus?

Only if it is a true modal that blocks the page, and then focus must be managed so users can always accept, reject or close it. A non-blocking banner should not trap focus. In either case, nobody should be stuck with no way out.

Where should the cookie banner be in the tab order?

Early, so keyboard users meet it before the rest of the page, or it should receive focus when it opens. A banner placed at the end of the HTML forces users to tab through the whole page first.

Can an accessible cookie banner still be compliant with consent rules?

Yes. Accessibility concerns how people operate the controls, not what you ask. Make sure the Accept and Reject choices are equally easy to use by keyboard, and that your tags respect the choice. Check consent law requirements with a professional.

Does FunnelGuard check cookie banner keyboard accessibility?

No. FunnelGuard monitors funnels such as forms, checkouts and tracking, not accessibility. Use an accessibility scanner like axe or Lighthouse and a manual keyboard test for this issue.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.