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: Motor:Why did my dictation jump to search?
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?

Broken/ and S jump to search from anywhere
Speech input (simulated):

Northfield Home

Linen napkins, set of 4

$24

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Add Ctrl or ⌘ to the shortcut, or let people turn it off

Before
Broken/ 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>
What is wrong3 points
  • People are thrown into search without asking. Every / and S pressed outside a text field moves focus there, even the S in a dictated word.
  • People who never use the keys can't stop them. Nothing turns the keys off.
  • Keeping only / would fail the same way. / is a character key too, and speech input can type it when someone says "slash".
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>
How it is fixed4 steps
  1. Act on K only while Ctrl or ⌘ is held, and not with Alt or Shift. A shortcut that needs Ctrl or ⌘ is no longer a character key shortcut, and speech input never holds Ctrl while it types a sentence.
  2. Drop the check for text fields. The key still works from anywhere on the page, including inside other fields.
  3. Add aria-keyshortcuts to the search field, so screen reader users hear about the key on the field it moves to.
  4. Show Ctrl K in the key cap; on a Mac, show ⌘K instead.

This fixes the Before: 2.1.4 no longer applies, since the shortcut is not a character key shortcut. Ctrl + K is the combination many sites and apps already use for search, so people may know it.

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.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service