liveBook · Manning

Keyboard accessibility

As explained in Architecting Accessibility

The ability to operate an interface through keyboard input without requiring a pointer or another input method.

A person may use a keyboard by choice, after a temporary injury, or because their assistive technology depends on keyboard input. If they cannot reach or activate a control without a mouse, that part of the interface is unavailable to them. Keyboard accessibility means people can access content and operate functionality without a pointer. section 5.2 section 5.3

Try navigating the page using only a keyboard. Ask:

  • Can you reach every interactive element in a logical order that matches the page? Can you always see which element has focus? section 5.3 section 5.6
  • Can you leave every component? Does a modal keep focus within it while open and return focus to its trigger when closed? section 5.3 section 5.6
  • Can you bypass repeated navigation with a skip link? Can you start, pause, stop, and mute media using controls with accessible names? section 5.6 section 3.4.3

Keep the alternative usable

A drag-and-drop file upload should also offer form controls so a keyboard user can upload a file. The goal is the same result, not an identical gesture. section 5.3

TIP: Start forms with native HTML controls and validation attributes such as required and minlength; they provide much of the expected keyboard behavior. Check custom validation and dynamic interactions separately. Keep focus visible and moving in a logical sequence, and never trap it. section 6.1.5

Table 6.2 Keyboard management in forms in specific situations
Form event or interaction
Expected keyboard behavior
A user moves through the form to understand it first, and fills in the necessary information
Users must be able to tab through the form fields following a logical order that reflects the meaning and expected operation. Focus must be visible for all elements and components in the form, and each control must be fully keyboard accessible.
A user changes a field value or selects an option from a list
Do not submit the form unexpectedly, navigate to another step, or automatically open a confirmation dialog simply because a value has changed. Users must have full control over context changes.
A form is submitted with incorrect data
Move keyboard focus to the first field in error, allowing the user to address the problem without additional effort.
A form containing many fields is submitted with multiple errors
When multiple errors are expected, consider moving the focus to an error summary area. The summary should also include links to each field that contains an error, so the user can jump directly to them.
A form uses the built-in HTML validation attributes
Focus is typically moved to the first field containing an error automatically when native HTML is used.
A form uses a custom client-side script for validation
Explicitly manage focus following the behavior outlined in this table. Help users fix errors efficiently.
A user is ready to submit or move to the next step
Offer a clearly labeled, keyboard-focusable button to deliberately trigger the desired action.

Use the form-event table to check tab order, unexpected context changes, and where focus goes after an invalid submission. section 6.1.5

NOTE: Browser restrictions on autoplay are not a substitute for accessible media design. Avoid audio that starts unexpectedly when a page loads; give people keyboard-accessible controls instead. section 3.4.3

How Architecting Accessibility covers it

How deep it goes
Develops checks for reachability, focus visibility and order, traps, dialogs, and form behavior; stops short of detailed custom-widget implementation.
Examples
Uses drag-and-drop file upload, modal dialogs, media controls, and form submission errors to make keyboard barriers concrete.
What you can do after
Practices keyboard-only checks of reachability, focus order, visible focus, traps, and predictable form behavior.
How it connects
Connects keyboard operation to focus management, skip links, semantic HTML, modal dialogs, forms, and media controls.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.