Sub topic 6
Designing for Keyboard Use
Assume you know basic wireframing, common controls such as buttons and forms, and how HTML provides page structure. This chapter focuses on turning a wireframe into an interaction plan that works without a mouse.
Start with a predictable focus order
Keyboard users move through interactive elements with the Tab key. The focus order should follow the page's reading order and the task's visual flow. A typical sequence is:
- Skip link
- Main navigation
- Page controls
- Main content
- Forms or action buttons
- Footer links
In a wireframe, number every interactive element in its intended sequence. If the visual layout places a “Continue” button before a “Back” button, the keyboard order should not reverse them without a clear reason.
Avoid using positive tabindex values to force an order. They create a second order that can become inconsistent as the page changes. Prefer native HTML elements and the document order.
Specify keyboard behavior for each control
A wireframe should state what each key does. Native controls already have expected behavior:
| Control | Enter | Space | Arrow keys |
|---|---|---|---|
| Button | Activates it | Activates it | No action |
| Link | Follows it | Usually no action | No action |
| Checkbox | No action | Toggles it | No action |
| Radio group | No action | Selects focused item | Moves selection |
| Menu button | Opens the menu | Opens the menu | Menu handles movement |
Use buttons for actions and links for navigation. Do not turn a styled div into a button unless you also recreate its keyboard behavior, focus behavior, name, and state.
For composite controls such as tabs, menus, date pickers, and carousels, document the arrow-key model in the annotation. State whether arrow keys move focus, change a value, or both. Provide an Escape action when a popup or dialog can close.
Annotate state changes
Keyboard users need the same feedback as pointer users. Mark states such as:
- Focused
- Expanded or collapsed
- Selected or unselected
- Disabled
- Invalid
- Loading
A menu button might be annotated as: “Enter or Space opens the menu. Arrow keys move through menu items. Escape closes the menu and returns focus to the button.”
Keep focus visible and contained
Each interactive element needs a visible focus indicator. Show it in the wireframe with a strong outline or other clear treatment. Do not rely only on a color change that may be hard to see.
When a dialog opens, move focus into the dialog, keep focus inside while it is open, and return focus to the opening control when it closes. For a disclosure or menu, focus should remain understandable after the content appears.
Use native controls where possible:
<button type="button" aria-expanded="false" aria-controls="filters">
Filters
</button>
<section id="filters" hidden>
<label for="status">Status</label>
<select id="status" name="status">
<option>Any status</option>
<option>Open</option>
<option>Closed</option>
</select>
</section>The aria-expanded value must change when the section opens. The hidden state must also change, and focus should move according to the documented interaction.
Exercise
A wireframe shows a custom card that opens details when clicked. What keyboard requirements should you add?
Show answer
Make the action a native button or link, include it in the logical focus order, show a visible focus indicator, define Enter and Space behavior, expose its expanded state when relevant, and return focus predictably when details close.