Keyboard accessibility for developers
Put the mouse down.
No, I'm not declaring war on mice. We're going to test whether your software can actually be used without one.
Why keyboard access matters
Some people cannot use a mouse easily or at all. Screen-reader users also commonly navigate interfaces from the keyboard.
Can I reach everything?
Start at the beginning of your interface and use the keyboard. On many interfaces, Tab and Shift+Tab move between interactive controls. Arrow keys are often used within controls such as menus, lists, radio groups or tabs.
Follow the conventions of your platform rather than inventing ten new keystrokes because they seemed exciting on Tuesday.
Focus needs to make sense
Keyboard focus is the control currently receiving keyboard input. Users need some way to identify it, visually and through the platform's accessibility information.
Do not remove visible focus indicators merely because you dislike how they look.
Tab order
Focus should normally move in an order that matches the logical structure of the interface. If Tab jumps from the top of a form to the bottom, back to the middle and then into a toolbar nobody knew existed, something has gone a little wrong.
Dialogs
When a dialog opens, focus should normally move somewhere useful inside it. While a modal dialog is open, users should not accidentally tab around controls behind it. When it closes, returning focus somewhere sensible matters too.
Keyboard shortcuts
Shortcuts can be brilliant, especially for repeated actions. They should supplement an accessible interface rather than being the only secret entrance to a feature.
Custom controls
If you create a custom control, find out how the equivalent native control behaves from the keyboard. Merely being reachable with Tab does not make a custom list behave like a list.
A quick test
- Close or ignore your mouse.
- Reach every important feature.
- Open and close every dialog.
- Try menus, lists, forms and error states.
- Make sure you can always tell where focus is.
- Make sure you can get back out of anything you enter.
If you become trapped somewhere, so can your users.
Further reading and external resources
Previous: Accessible development | Next: Accessible controls and sensible defaults
Image Description