Step 15 of 32

Pop-ups and cookie banners

By the end of this step: you will be able to check that your pop-ups and cookie banners can be opened, used and closed with a keyboard, and that they don't cover what a visitor is trying to reach.

The short version

  • A pop-up is a box that appears on top of your page. A cookie notice and a sign-up box are both pop-ups.
  • A visitor who uses a keyboard must be able to reach every button in it, and close it.
  • A banner must not cover the button or link the visitor has just reached.
  • Test it yourself with the Tab key. It takes two minutes.

Why pop-ups cause trouble

A mouse user glances at a pop-up and clicks the cross. A keyboard user has a harder time. They move around with the Tab key. If the pop-up isn't built well, Tab may skip it, or take them to a part of the page hidden behind it.

That's why this page matters for a shop. Cookie notices and sign-up boxes show up on the first visit. They are often the first thing a new customer meets.

Rule 1: nobody gets stuck

WCAG 2.1.2 No Keyboard Trap (Level A) has a plain goal: keyboard users don't get stuck.[1] It asks you to make sure people always know how to move away from a part of the page.[1]

A pop-up can keep the Tab key inside it while it is open. That is normal. But the visitor must be able to leave. W3C says the Esc key is a commonly used standard way to exit.[1] Add a clear Close button too.

Three boxes joined by arrows: 1. Open, button pressed. 2. Inside, focus moves in. 3. Close, Esc or Close button. A dashed arrow runs back to the first box. Text: focus goes back to the button that opened the pop-up. Tab keeps moving inside the pop-up while it is open.
Where keyboard focus should go when a pop-up opens and closes.

What should happen when a pop-up opens and closes

W3C's guide to building a modal dialog sets out the usual pattern. A modal dialog is a pop-up that must be dealt with before the visitor can use the page behind it.

  • When it opens, focus moves to something inside it.[2]
  • Pressing Esc closes it.[2]
  • When it closes, focus goes back to the element that opened it.[2]

Focus is the spot on the page that the keyboard is working on right now. Without that last step, a visitor can lose their place and have to start again from the top of the page.

You won't build this yourself. But you can check that your pop-up does these three things. If it doesn't, ask the maker of the tool to fix it.

Rule 2: don't hide what the keyboard has reached

A cookie banner often sticks to the bottom of the screen. That is fine until a visitor tabs down the page and reaches a link behind it.

WCAG 2.4.11 Focus Not Obscured (Minimum) (Level AA) has one aim. Whatever has keyboard focus must not be entirely hidden by content you put on the page.[3] W3C names sticky footers, sticky headers and non-modal dialogs as common causes.[3]

It also names cookie banners. A sticky one fails if it completely covers something that has focus.[3]

Two small page drawings. Left, labelled Fails: a dark cookie banner covers the button the keyboard has reached. Right, labelled Passes: the banner sits lower and the button shows above it. A red edge marks the button reached with Tab.
A banner must not completely cover the thing the keyboard has reached.

W3C lists two ways to pass. One is to make the banner modal, so the visitor has to dismiss it before moving through the page. The other is to use scroll padding, so the banner doesn't overlap the content.[3] Scroll padding is a setting your web designer can add. It keeps a gap at the edge of the screen for the banner.

Check your own pop-ups

You need a keyboard and a few minutes.

A checklist titled Test every pop-up with a keyboard. Four empty tick boxes: Tab reaches the pop-up buttons; Esc or a Close button shuts it; you can see where focus is; after closing, focus is not lost.
Four quick keyboard checks for any pop-up.
  1. Open your home page in a fresh private window. That way your cookie notice shows again.
  2. Press Tab. Can you reach the buttons in the notice?
  3. Press Esc, or choose the Close button. Does it close?
  4. Keep pressing Tab down the page. Can you always see where you are?
  5. Do the same for any sign-up box, chat button or sale banner.

If something fails

  • Ask the tool's maker. Most cookie notices and sign-up boxes come from a plug-in or an add-on. Look in its settings for a "modal" or "accessibility" option.
  • Ask for a fix to the banner. Point to the two ways to pass above.
  • Remove it. If a sign-up box causes trouble and you don't need it, switching it off is a fair choice.

Try it on your site

  1. List every pop-up, banner and floating button on your site.
  2. Run the five checks above on each one.
  3. Write down what fails, with the page address.
  4. Send that list to your web designer or the tool's support team. Then test again.

For more on moving banners, see Sliders, auto-playing and moving content. For the keyboard basics, see Keyboard access.

Sources

  1. Understanding Success Criterion 2.1.2: No Keyboard Trap, W3C Web Accessibility Initiative (accessed 2026-11-02)
  2. Dialog (Modal) Pattern, W3C Web Accessibility Initiative (accessed 2026-11-02)
  3. Understanding Success Criterion 2.4.11: Focus Not Obscured (Minimum), W3C Web Accessibility Initiative (accessed 2026-11-02)