Success Criterion 2.1.1 Keyboard: [Level A]
This states that any page functionality must be available using the keyboard, except where it cannot be accomplished in any known way using the keyboard . There should be no time element involved in the the keystrokes except where a particular execution requires multiple keystrokes within a short period of time or requires a key to be held down for an extended period before it is registered.
Techniques
Ensuring keyboard control for all functionality
This technique simply ensures that any functionality on the page can all be operated by using only the keyboard. This does not mean that non-keyboard methods are not permitted.
Using HTML controls and forms
Using standard HTML controls ensures that the page is accessible by keyboard operation. See SC 4.1.2 for examples.
Providing keyboard-triggered event handlers
Any event handlers triggered by non-keyboard UI events should also be associated with a keyboard-based event. For instance if there was some 'drag and drop' facility in the page, there should be functionality provided by which the same operation could be performed using the keyboard.
Using both keyboard and other device-specific functions
Scipting functionality should allow for both mouse and keyboard events. The table below shows the equivalent events that can be detected by JavaScript.
| Mouse event | Key event |
|---|---|
mousedown |
keydown |
mouseup |
keyup |
click [1] |
keypress [2] |
mouseover |
focus |
mouseout |
blur |
1 Although click is in principle a mouse event handler, most HTML and XHTML user agents process this event when the control is activated, regardless of whether it was activated with the mouse or the keyboard. In practice, therefore, it is not necessary to duplicate this event. It is included here for completeness since non-HTML user agents do have this issue.
2 Since the keypress event handler reacts to any key, the event handler function should check first to ensure the Enter key was pressed before proceeding to handle the event. Otherwise, the event handler will run each time the user presses any key, even the tab key to leave the control, and this is usually not desirable.
Some mouse-specific functions (such as dblclick and mousemove) do not have a corresponding keyboard-specific function. This means that some functions may need to be implemented differently for each device (for example, including a series of buttons to execute, via keyboard, the equivalent mouse-specific functions implemented).
HTML controls like links and buttons trigger a 'click' event when either clicked by a mouse or when the control is in focus and the enter key pressed. These actions can be readily detected by a script either by using a mouse or the keyboard.
In the following example, click on the link and the button and then set focus on each control in turn and press the enter key. You should get the same results as with the mouse.
One common practice with a mouse is to change an image when the mouse overs over a control. This should also be accomplished by using the keyboard. In the example below, hover over the link and the image changes colour, move away it reverts back to the original color. Repeat this using the keyboard to give it focus and then tab away from it.
When using the keyboard, you may click first to give you a starting point on the page to start tabbing from.
Failures
Mouse specific event handler
A typical failure is when an event handling specifically concentrates on mouse events ignoring keyboard equivalents.
For instance, in this next example a mouse down event is used to call a JavaScript function which performs the navigation. If a key is pressed instead the mousedown event is ignored.
Link emulation not programatically determinable
This failure is where a link has been emulated in a way which does not allow access to the 'link' element via the keyboard. An image is used for the link but an img element is not navigable to busing the keyboard.
