KBD-003 Let people turn off or change a shortcut made only of character keys
- Level
- Rule
- Verdict
- Requirement
- Area
- Keyboard
- Status
- proposed, version 1.0.0
Rule
When the page reacts to a shortcut made only of character keys (letters, digits, punctuation or symbols, with or without Shift), people can turn it off or change it to include a key that types nothing, such as Ctrl, Alt or Cmd, unless it works only while its own control has focus.
Examples
Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.
Do: A switch turns single-key shortcuts off
#482 Printer offline (Open)
Do: j and k act only inside the list
j next ticketk previous ticketonly in the list
Don't: Page-wide e, and the text-field guard is the only protection
#482 Printer offline (Open)
/ searche close? list
Don't: Shift+D with no way out
Quarterly update (draft)
Shift+D delete draft
Why
A shortcut on a single letter fires whenever that letter reaches the page. Some speech input programs turn spoken words into key presses, so a stray word can archive, delete or move things they never meant to touch. Keyboard users with tremors hit keys by accident, and the same happens to anyone whose focus has slipped out of a field. WCAG 2.2, 2.1.4 Character Key Shortcuts requires one of three ways out for such a shortcut: a way to turn it off, a way to remap it to include a key that types nothing, or a shortcut that acts only while its own component has focus. The criterion treats the three as equal, and so does this rule. The Working Group shows how to meet it in G217 and what fails in F99. This rule is the floor the law sets. KBD-003b goes further, as a rule the judges decide: it asks that shortcuts include a modifier key from the start, so that this rule's way out is seldom needed. Where both apply, this rule comes first. A single-key set the person turned on must be possible to turn off again, and a shortcut that adds only Shift, such as Shift+D, still needs one of the three ways out here, even though it meets KBD-003b's default.
Do
- In a team's ticket desk,
/moves focus to Search tickets,ecloses the selected ticket and?opens the list of shortcuts. Settings has a switch Single-key shortcuts that turns all three off. With it off, the page ignores those keys. This is the first way out. The switch starts off, as KBD-003b asks; this rule only needs it to exist. - Offer the second way instead, or as well: in Settings > Keyboard shortcuts, each shortcut can be changed to one with Ctrl, Alt or Cmd, such as Alt+E for Close ticket.
- Or use the third way: handle
jandkon the ticket list's ownonKeyDown, so they move the selection only while the list or a row in it has focus. A listener ondocumentorwindowis not focus-bound, even when the shortcut is meant for one panel. - Do not count Shift as a modifier; in these texts a modifier is Ctrl, Alt or Cmd.
?is often Shift plus/, and Shift+D still types a character, so both need a way out. A sequence such asgthentfor Go to tickets is made of character keys too. - Make the switch and the remap screen work by keyboard, like any other control (KBD-001), and keep the choice once made, for example per account. How long the choice lasts is our own advice; the criterion does not say.
- Keep ignoring keys typed in
input,textareaand[contenteditable], so shortcuts never eat text. It is needed, but it is not one of the three ways out. - Shortcuts with Ctrl, Alt or Cmd are outside this rule. A command menu that opens on Cmd+K or Ctrl+K and the shadcn sidebar toggle on Cmd+B or Ctrl+B are fine as they are.
- Keep every shortcut an extra beside a visible control, as KBD-001 says. Close ticket is still a button.
Don't
- Bind
useHotkeys("e", closeTicket)in the layout and offer no setting, so a speech user's word "edit" closes the ticket on screen. - Add a
keydownlistener ondocumentthat focuses search on/, and count the guard for text fields as the fix. - Use Shift+D for Delete draft on the whole page with no way out, as if Shift made it safe.
- Hide the switch so well that only people who read the help page find it. The criterion only asks that it exists; KBD-003a is where people find shortcuts and the place to link it from.
Exceptions
- Focus-bound keys. Keys that act only while their own control has focus meet the rule as they are: typeahead in a
Selector listbox, letter keys in an openDropdownMenu,jandkon a list's ownonKeyDown, auseHotkeyswhose ref is attached to the list,tinykeysbound to an element rather thanwindowordocument, single-key tools on a focused drawing canvas, and/that opens a block menu inside a focused editor. - Keys outside the criterion. Escape, the arrow keys, Home, End, Page Up, Page Down, Tab, Enter, Space, Delete, Backspace and the function keys are not letters, digits, punctuation or symbols, and the Working Group's failure test leaves them out. Closing a panel with Escape is outside this rule.
- Text input. Characters typed into a focused field or editor are input, not shortcuts.
- Keys that are not the page's. The browser's and the screen reader's own keys are outside this rule.
- Neighbouring rules. The visible control beside every shortcut is KBD-001, telling people a shortcut exists is KBD-003a, and the judges' default of a modifier key is KBD-003b.
Verdict
Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work
| Source | Role | Stance | Page |
|---|---|---|---|
| WCAG 2.2 | Law | Requires | 2.1.4 Character Key Shortcuts |
| WCAG 2.2 | Law | Supports | 2.1.1 Keyboard |
| Material Design | Judge | Supports | Accessibility designing: flow |
| Apple Human Interface Guidelines | Judge | Supports | Keyboards |
| Carbon Design System | Judge | No position | |
| GOV.UK Design System | Expert witness | No position | |
| Nielsen Norman Group | Expert witness | Supports | UI Copy: UX Guidelines for Command Names and Keyboard Shortcuts, by Anna Kaley |
Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.
History
- Version 1.0.0, : First version.
Last checked against the other rules for conflicts on .
More in Keyboard: 5 rules and 0 guidelines · All rules
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.