A keyboard trap is a focused website component that a person can enter with a keyboard but cannot leave using a keyboard. Fix it by providing a clear keyboard exit, restoring focus when an action hides or removes the focused element, and testing the interaction without a mouse. A modal dialog is a special case: keeping focus inside while it is open can be correct, as long as people can operate and dismiss it and focus returns to a useful place.
What counts as a keyboard trap?
WCAG Success Criterion 2.1.2, No Keyboard Trap (Level A), requires that if keyboard focus can move to a page component, users can also move it away using a keyboard interface. If leaving requires more than standard keys or methods, the page must tell users how to exit. Read the W3C explanation of No Keyboard Trap.
As an Amazon Associate I earn from qualifying purchases.
A component that temporarily contains focus is not automatically a failure. The important distinction is whether the containment is intentional and whether the user has an effective keyboard route to complete or leave the interaction.
Free tools Windows power users keep installed
One-click scans. No signup required.
Find the trap or lost focus with a keyboard
- Start before the interaction and press Tab until focus reaches the component. Use Shift+Tab to move in reverse.
- Note where focus enters, which keys move it within the component, what happens at its apparent boundary, and whether a visible focus indicator shows the current location.
- Try the widget’s documented keyboard controls as well as Tab. Some composite widgets use arrow keys for movement within the control; custom ARIA widgets require authors to provide their keyboard support. See W3C’s guidance on developing a keyboard interface.
- Continue through the interaction that closes, hides, or changes the component. Check whether focus lands on a useful control or appears to disappear.
Decide whether focus containment is intentional
Modal dialog
While a modal dialog is open, Tab may move through its focusable controls and wrap from the last control to the first; Shift+Tab wraps in the opposite direction. This keeps keyboard focus in the active dialog rather than letting it wander behind the modal. The WAI-ARIA Dialog (Modal) Pattern describes this behavior; its modal dialog example lists Escape as a close command.
#1 Best Overall
- KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
- EASY SETUP: Experience simple installation with the USB wired connection
- VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
- SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
- FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.
Do not “fix” an active modal by allowing focus to move behind it. Instead, make sure its controls work, provide a usable dismissal route, and return focus sensibly when it closes.
Nonmodal component
A menu, widget, or other nonmodal component should not hold focus in a way that prevents users from reaching the rest of the page. Ensure the keyboard interaction allows an exit. If that exit uses a nonstandard method, explain it where users can find the instruction.
Rank #2
- All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
- Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
- Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
- Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
- Plastic parts in K120 include 51% certified post-consumer recycled plastic*
Restore focus after an action
Focus can seem to vanish when an action hides or removes the element that currently has it. If the browser can no longer focus that element, it may place focus on the document body, leaving the user unsure where they are. When closing a dialog, removing a menu, or deleting a focused item, deliberately move focus to an appropriate element that remains available.
Recommended Free Tools
- When a dialog closes, return focus to its invoking control if that control is still present and usable.
- If the invoking control no longer exists, choose another logical destination, such as the next relevant control in the interface.
- When deleting a focused item from a list, consider moving focus to the following item. W3C’s keyboard-interface guidance discusses focus persistence and logical destinations.
Choose native or custom dialog behavior
W3C’s HTML dialog technique describes browser-managed behavior for a modal dialog: focus moves into it, content outside is inert while it is modal, Escape dismisses it, and focus returns to the invoking element if that element remains on the page. A custom ARIA dialog needs authors to provide comparable behavior.
Rank #3
- A plug-and-play USB connection with Low-profile keys give you a quiet, comfortable typing experience
- Simple Wired USB Connection,You will enjoy a comfortable and quiet typing experience
- The keyboard for business and office working is the budget-friendly keyboard that is built for longer use
- Low profile keys for a more comfortable and quiet keystroke, desktop-centric design, splash resistant
| Behavior | HTML dialog |
Custom ARIA dialog |
|---|---|---|
| Focus entry and return | The W3C technique describes browser-managed focus entry and return to the invoking element if it remains present. W3C H102 | Authors must implement focus movement and a sensible return destination. W3C keyboard-interface guidance |
| Outside content while modal | Outside content is inert during modal display under the documented technique. W3C H102 | The custom implementation must prevent interaction with content behind the active modal. WAI-ARIA Dialog (Modal) Pattern |
| Keyboard containment | The documented technique includes focus within the modal. W3C H102 | Authors must implement the modal focus sequence. WAI-ARIA Dialog (Modal) Pattern |
| Escape dismissal | The documented technique describes Escape dismissal. W3C H102 | Authors must provide a keyboard dismissal path; Escape is listed in the APG modal example. WAI-ARIA modal dialog example |
| Focus-management code | The browser manages behaviors described by the technique, though the implementation still needs to use the element correctly. W3C H102 | Authors supply the equivalent focus management and keyboard interaction. W3C keyboard-interface guidance |
H102 is a documented technique, not the only way to meet WCAG. Whichever approach you use, verify the behavior in the browsers and assistive technologies your site supports.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Check the repaired interaction and focus order
- Use only the keyboard to enter the component, operate it, and leave it.
- Confirm focus remains visibly indicated as it moves.
- Close the dialog or remove the focused item, then verify focus lands on an available, logical control.
- Continue through surrounding content. WCAG Success Criterion 2.4.3 requires a sequential focus order that preserves meaning and operability; it does not have to exactly match the visual layout. See the W3C explanation of Focus Order.
These checks are an initial review, not proof of full accessibility conformance. W3C’s Easy Checks can help with a first review, alongside its broader accessibility principles.
Quick Recap
Best Value
- The Lenovo 300 USB keyboard offers an intuitive and comfortable island key design with 2 5 zone layout including separate number pad
- This full-size keyboard includes concaved key caps fitted for your fingertips
- Spill resistant keys with a board drain help keep your PC keyboard protected and keep you productive
- The complete ergonomic design includes an adjustable tilt to improve your typing comfort
- OS independent – This convenient computer keyboard works with laptops desktops and any computer with a USB port
Rank #4
- Durable and Reliable: This USB keyboard features a curved space bar, spill-resistant design (2), durable keys that can withstand 10 million keystrokes, and sturdy, adjustable tilt legs
- Comfortable, Familiar Typing: You’ll enjoy a comfortable and familiar typing experience thanks to the deep-profile keys and standard layout with full-size F-keys and number pad
- Full-size Sculpted Mouse: The high-definition optical USB mouse puts comfort and control in your hands with smooth, accurate tracking and an ambidextrous shape that feels good hour after hour
- Simple Set-Up: Simply plug the keyboard and mouse into the USB ports on your desktop, laptop, or netbook and you're ready to work; compatible with Windows 7, 8, 10 or later
- Clear and Convenient: The bold, bright white and long-lasting characters make the keys on this PC or laptop keyboard easy to read and extra durable
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




