• Success Criterion 2.1.4
  • Conformance level A

Global Single-Key Shortcut That Fires During Speech Dictation

2.1.4 — Character Key Shortcuts

Scenario

Setting

An online marketplace's seller dashboard

What’s wrong

Global single-key shortcuts (e.g., "?", "j/k", "s" to search) active page-wide, firing during speech input dictation.

Example

document.addEventListener('keydown', (e) => {
  if (e.key === '?') openHelpPanel();
  if (e.key === '/') document.getElementById('search').focus();
});
// no check for whether focus is already inside a text field

Why it matters

A seller dictating a product description who says a phrase ending in a question mark suddenly gets a help panel popping open over their draft.

How to test

Press single keys like '?' or 'j'/'k'/'s' while browsing normally (not in a text field): if these trigger actions site-wide with no way to disable them, it fails — especially disruptive for speech-input users dictating text.

How to fix

Always check the active element before running a single-character shortcut, and skip it whenever focus is inside editable text.

document.addEventListener('keydown', (e) => {
  const inField = e.target.matches('input, textarea, [contenteditable="true"]');
  if (inField) return;
  if (e.key === '?') openHelpPanel();
  if (e.key === '/') document.getElementById('search').focus();
});

Outcome

A seller dictates a full product description without the help panel or search field interrupting them.

Who is affected

Speech-input users lose their place mid-dictation whenever a spoken word matches a global shortcut character.

Learn more