Skip to content
easeweb
Search topics

Single-key shortcuts that can't be turned off

A shop's / and S keys jump to the search box from anywhere on the page, so a dictated sentence ends up as a search.

WCAG 2.2
SC 2.1.4A· new in 2.1
Required by
EN 301 549 (EU)
Broken event.key === 's'
The accessibility problem illustrated: Dictated for the gift message, but the S jumped to search and took the rest with it.
01

The problem

Speech input users, and anyone who presses a key by mistake, are thrown into the search box, and what they say next goes with them.

02

Try it

Before clicking into Gift message, say the message with the speech input above the window.

Speech input types into whatever has focus, one key at a time. Watch where the words go, then click into Gift message and say it again. You can also click the page and press / or S yourself.

Broken Can you fix this?

Speech input (simulated):

Northfield Home

Linen napkins, set of 4

$24

Search box: empty

Gift message: empty

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Add Ctrl or ⌘ to the key, or let people turn the single keys off.

  1. 1No bare letter, number or symbol key acts on the whole page unless people can turn it off.
  2. 2Show the shortcut by the search box, and in aria-keyshortcuts while it works.
  3. 3Whatever else you do, ignore key presses in text fields.
Before / and S jump to search from anywhere
<form role="search" action="/search">  <label for="search">Search</label>  <input id="search" name="q" type="search">  <kbd>/</kbd> <kbd>S</kbd></form>
After

Ctrl + K, or ⌘K on a Mac

<form role="search" action="/search">  <label for="search">Search</label>  <input id="search" name="q" type="search" aria-keyshortcuts="Control+K Meta+K">  <kbd>Ctrl K</kbd></form>

Fixing this with an AI coding assistant? Get this guide as Markdown

04

Verify the fix

4 checks, no mouse.

Test with: Keyboard, Speech input, Screen reader

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after adding a shortcut or a third-party script.

Limits

This is a starting pattern, not a guarantee for every application. The snippets leave out the search itself and saving the setting to a customer's account. Test the complete journey with a keyboard, speech input and your target assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work