Reviewed November 23, 2026
WCAG 2.1.1 Keyboard and 2.1.2 No Keyboard Trap: Testing Your Cart Drawer the Way a Keyboard User Meets It
WCAG 2.1 success criterion 2.1.1, Keyboard, Level A, requires all functionality to be operable through a keyboard interface. Criterion 2.1.2, No Keyboard Trap, also Level A, requires that if focus can move into a component, it can move out again using only the keyboard. A cart drawer that opens without moving focus, cannot be closed with Escape, or traps Tab cycling inside itself while the page behind is still the task, fails one or both. A properly built modal dialog is the one allowed exception, and it has a strict contract.
Keyboard testing is the fastest honest audit a store can run, because it needs no tools and no expertise beyond patience. Unplug the mouse, open the store, and try to buy something. Most teams find their first failure within a minute: a menu that only opens on hover, an icon with no focus stop, or a drawer that swallows the Tab key and never gives it back.
The trap failure is the one users remember. A sighted keyboard user can at least see focus circling inside a drawer. A screen reader user in the same trap has no map of where they are, and the only exit is closing the tab, along with the purchase.
What operable actually means, control by control
Every hover behavior needs a keyboard equivalent. Mega menus that open on mouse hover must open on focus or on a button activation, and their links must be reachable in a sane order. Carousels need pause and next controls that are real buttons. The quantity stepper, the swatch selector, the filter checkboxes, the chat launcher: if a mouse can change it, Tab and the standard keys, Enter, Space, arrows where the pattern calls for them, must change it too.
Visible focus is the companion requirement, covered by criterion 2.4.7, and it is what makes keyboard operation usable rather than theoretical. A control that is focusable but shows no indicator is operable in the same sense a door with no handle is openable. Test both together: Tab through the page and ask, at every stop, can I see where I am, and can I do the thing this control promises.
The drawer contract
A cart drawer that behaves as a modal, dimming and disabling the page behind it, must follow the dialog pattern from the W3C ARIA Authoring Practices: focus moves into the drawer on open, Tab cycles within it while it is open, Escape closes it, and focus returns to the button that opened it. That cycle is not a trap under 2.1.2 because it is the documented behavior of a modal and the user always has Escape as an exit.
The failures are the half-built versions. Focus stays on the page behind while the drawer opens visually. Or focus enters and Escape does nothing because the key handler was only wired to the close icon. Or the drawer closes and focus drops to the top of the document, and the user tabs through the entire header again to resume shopping. Each one is a small bug in isolation and a wall in sequence.
A test script a store can run in an hour
Write the purchase path as a list: open a category, filter it, open a product, choose a variant, add to cart, change the quantity, apply a code, check out. Run it keyboard-only and log every stop where you cannot see focus, cannot activate a control, or cannot escape a component. That log is your 2.1.1 and 2.1.2 defect list, written in user language a developer can act on without an accessibility consultant translating.
Retest after every theme update and every new app install, because drawers and menus are exactly what apps and updates modify. Keyboard regressions rarely announce themselves. They arrive silently inside a feature someone shipped for mouse users, and the first person to find them is a customer who cannot buy from you.
Related reading
Readers working through “WCAG 2.1.1 Keyboard and 2.1.2 No Keyboard Trap: Testing Your Cart Drawer the Way a Keyboard User Meets It” often find these earlier guides useful as well: At 320 Pixels Wide, Your Product Page Should Not Scroll Sideways, Removing the Focus Outline for Looks Breaks 2.4.7 on Every Page at Once, and WCAG 1.4.12 Text Spacing Breaks Product Pages That Clip Their Own Copy.
Frequently asked questions
What is the difference between 2.1.1 and 2.1.2?
Criterion 2.1.1 Keyboard requires all functionality to be operable by keyboard. Criterion 2.1.2 No Keyboard Trap requires that keyboard focus can always move away from a component using the keyboard alone. One is about getting in and operating, the other about never being stuck.
Is focus cycling inside a cart drawer a keyboard trap?
Not if the drawer is a true modal: focus moved in on open, Escape closes it, and focus returns to the trigger. That is the documented dialog pattern. Cycling with no Escape exit, or focus that never entered the drawer, is a failure.
Do menus that open on hover fail WCAG?
They fail 2.1.1 if there is no keyboard way to open them and reach their links. A menu button that opens on focus or activation, with links in a logical order, satisfies the requirement.
What keys should a custom control support?
At minimum Tab to reach it, Enter or Space to activate buttons, and arrow keys inside composite widgets such as menus, tabs, and radio groups, following the W3C ARIA Authoring Practices pattern for that widget.