Whenever a script is controlled by the mouse, it must also be possible to control it with the keyboard, and vice versa.
In other words, each time the mouse can be used to control a script, using an element such as a link or button, the user must be able to:
Whenever possible, use generic event listeners rather than specific ones for a keyboard button. For example, use onfocus
/onblur
rather than onkeydown
.
This is important because keyboard shortcuts are not always the same on different systems and browsers. For example, in the Opera browser, the Shift
key, together with the arrow keys, allows the user to navigate from one link to another. However, most other browsers use the Tab
key for this shortcut.
It is very important to avoid keyboard traps. Keyboard traps block a user who navigates with the keyboard, because they prevent interaction with specific zones on the page.
Keyboard traps arise when a user is blocked on a page when navigating with a keyboard:
Each time that scripts are used on a page, make sure they do not contain keyboard traps by running a simple test on the interface with the keyboard.