R

RatedWithAI

WCAG guidance

Scan your site

WCAG 2.1

2.1.4 Character Key Shortcuts

Level A success criterion

If a keyboard shortcut is implemented using only letter, punctuation, number, or symbol characters, then at least one of the following is true: the shortcut can be turned off, remapped to include a modifier key (Ctrl, Alt), or is only active when the relevant component has focus.

Why it matters

Speech input users may accidentally trigger shortcuts when dictating text. Users with motor impairments may accidentally press keys. Single-character shortcuts can cause chaos for these users.

Common violations

  • Single-key shortcuts (e.g., 'j' for next, 'k' for previous) that cannot be disabled
  • Keyboard shortcuts that conflict with speech input commands
  • Character shortcuts active even when user is typing in a text field
  • No settings panel to remap or disable shortcuts

Code examples

Bad

document.addEventListener('keydown', (e) => {
  if (e.key === 'j') nextItem();
  if (e.key === 'k') prevItem();
});

Good

document.addEventListener('keydown', (e) => {
  if (!shortcutsEnabled) return;
  if (e.target.matches('input, textarea')) return;
  if (e.key === 'j' && e.ctrlKey) nextItem();
});

How to fix

Allow users to disable or remap single-character shortcuts. Require modifier keys (Ctrl, Alt, Shift) for global shortcuts. Ensure shortcuts are inactive when focus is in text input fields.

Related criteria

Related resources

Scan your site

Check your WCAG coverage in minutes

Start a free scan