Accessibility Certified – Home

2.1.4 Character Key Shortcuts

Keyboard shortcuts that use a single letter, number or symbol key must be possible to turn off, remap, or only work when the component has focus.

Level APrinciple 2: Operable

What does it mean?

Some web apps react to single keys: "s" to search, "j" and "k" to move through a list, "m" to mute. For people who use speech input, a spoken word can produce many letters at once and trigger several shortcuts by accident. People who type slowly or hit keys by mistake have the same problem.

If such shortcuts exist, at least one of these must be true: the user can switch them off; the user can change them to include a modifier key such as Ctrl or Alt; or the shortcut only works while the relevant component (for example a list or player) has focus. Shortcuts that already need Ctrl, Alt or Cmd are not affected.

Who does it help?

  • People who control the computer by voice
  • People with tremors or limited dexterity who press keys by accident
  • Keyboard users whose assistive software uses single keys itself

Common failures

  • A site-wide listener that starts a search or opens a chat when the user presses a single letter
  • A media player that mutes or skips on a single key even when focus is elsewhere on the page
  • Single-key shortcuts with no settings to disable or change them

How we test it

  • people only Manual only: nothing useful can be measured. The reviewer tests it directly.

Test question: Single-key shortcuts (letters, numbers) must be switchable off, remappable or only active on focus.

A person decides every criterion. No criterion ever passes automatically.

How to fix it

Problem
document.addEventListener('keydown', (e) => {
  if (e.key === 's') openSearch();
});
Better
document.addEventListener('keydown', (e) => {
  if (!prefs.shortcuts) return;          // user can turn them off
  if (e.altKey && e.key === 's') {       // modifier required
    e.preventDefault();
    openSearch();
  }
});

The shortcut now needs a modifier key and respects a user setting that switches shortcuts off.

Practical tips

  • Ignore key events that come from input fields, textareas and contenteditable areas.
  • List all shortcuts on a help page or in a dialog together with the switch to disable them.

Guides and patterns on this

Official source

Understanding WCAG 2.2 at the W3C: 2.1.4 Character Key Shortcuts

How does your website do on this criterion?

The free check tests your home page automatically; the audit decides all 55 criteria.

Free checkAll criteria