vocab.design

interaction · keyboard

Keyboard shortcut

also called hotkey, accelerator, key binding, shortcut key

A key or key combination that runs a command directly, giving practised users a path that skips the menus and the pointer entirely.

A shortcut is an accelerator, not a mechanism. The APG is blunt about this: it enhances keyboard access, it never replaces it. Every command a shortcut runs has to be reachable another way, by tabbing to a control and pressing it, because a key nobody was told about is not an affordance. The corollary is that shortcuts have to be advertised. Print the key next to its command in the menu, on the button’s tooltip, or in a shortcuts panel behind a question mark, and use the same notation everywhere.

There are two families and they behave differently. A single-key shortcut (Gmail’s e for archive, j and k to move down and up) is fast and cheap to learn, but it fires while the reader is typing unless you check the event target, and it is hostile to screen reader users whose software already owns most letters in its browse mode. A chorded shortcut (Ctrl or Cmd plus a key) avoids both problems and is what you want for anything destructive or global. Follow the platform on the familiar ones: Cmd or Ctrl S saves, Z undoes, and the modifier itself differs by platform, so read it from the user agent rather than shipping Ctrl to a Mac.

Watch what you are taking away. The browser and the operating system got the keyboard first, and rebinding Ctrl W, Ctrl T, or Cmd Q either fails or breaks something the reader relies on. Assistive technology reserves more keys than most teams expect, which is why the APG’s advice is to prefer combinations that include a modifier and to test with a screen reader running rather than assuming a letter is free.

Two habits make the rest easier: keep the bindings in one table so a conflict is visible when it is created, and let people see that table from inside the product, conventionally by pressing the question mark key.

Which word?

If you wantsay
a command reachable by keys instead of controlskeyboard shortcut
printing a key the reader should presskeyboard key
one keystroke reaches every command by namecommand palette
a bare letter key does something on the pagecharacter key shortcuts
keys pressed together rather than one after anotherchorded shortcut

Related

See also: Keyboard shortcuts dialog · Key repeat

Implementations

Specimens illustrate the concept; for production use, start here.

aria-apgKeyboard shortcuts

Sources