Keyboard Testing
Being able to navigate and operate all the functions of a web page or application using only keyboard commands is a key principle of accessibility. It is necessary for users with physical disabilities who cannot use a mouse, and also required for people who are blind and cannot see the mouse pointer. Luckily, testing for keyboard operability is relatively easy. It does not require any special technology or skill, just awareness of a few standard keyboard commands:
The Basics
- Tab - Move to the next interactive element.
- Shift + Tab - Move backwards to the previous interactive element (when needed).
- Right or Left Arrow - Move horizontally through items in a menu bar, tab list, or grid.
- Up or Down Arrow - Move vertically through items in a dropdown list, list box, radio button group, menu, or grid.
- Alt + Down Arrow - Open a dropdown list or calendar popup.
- Spacebar - Check a checkbox or click a button.
- Enter - Click a link.
- Alt + Left Arrow - After clicking a link, go back to the previous page.
How to Test
To test, simply start at the top of the page, press the Tab key to move focus, and check for:
- Interactive elements that do not receive keyboard focus. (WCAG 2.1.1)
- Elements that do not show a visual indicator (e.g., an outline) when focused. (WCAG 2.4.7)
- Elements that do not receive focus in a logical order (e.g. left to right, top to bottom). (WCAG 2.4.3)
- Elements that cause unexpected changes (e.g., reload the page) when they receive focus. (WCAG 3.2.1)
- Elements that cannot be operated using standard keyboard commands. (WCAG 2.1.1)
- Elements that cause unexpected changes when values are changed. (WCAG 3.2.2)
- Elements that trap focus (i.e., prevent focus from moving to the next element). (WCAG 2.1.2)
Getting Advanced
The above commands work for standard web controls, however, web pages may include advanced elements such as accordions, tree views, and more. Each advanced element must still follow a standard set of keyboard commands, which are specified at:
If any of these advanced controls are present, be sure to look up their keyboard commands (using the links above) and test them too.