Skip to content

A11y 101: 2.1.4 Character Key Shortcuts

Hopefully those of you working towards EAA are breathing a little easier today. While some of you were pushing last minute updates, I attended my local Pride celebration.

Well organized and attended, it reminded me why I do this work. People from 1-99+. People with visible disabilities. People with disabilities only visible because they made it so by wearing a device to control the disability (hearings aids off, headphones, walkers instead of canes). This wasn’t a celebration of LGBTQ+, this was a celebration of people being people.

But this job is never done. There is a difference in doing the day-to-day work compared to studying for the final though. Well, you turned in your final. Let’s get back to the regularly scheduled work.

Keyboard shortcuts are designed to help multiple disabilities. Keyboard only users, users with limited control, and screen reader users are just the beginning. But we always need to be careful when developing them.

Respect the user

Every user has a different combination of tools to help them along. Each of these tools brings its own set of keyboard shortcuts. The OS has shortcut keys. So do the browser, the application, and the screen reader. This means much of the keyboard is mapped to something.

We do not want to break or override those controls. To go about this we need to do two things, research for which combos to use and flexibility. And the mention of combos here is important.

If we create a set of keyboard shortcuts, we should have an interface that displays them. Additionally, it should allow the user to remap them. Gmail has a decent approach. You first need to turn on the keyboard shortcut controls. Once on “?” will open a screen that lists all the short cuts.

Google's Gmail Keyboard Shortcut overlay with roughly 40 different key options on the first screen. There are two screens total.

This is a good example of how to display and inform the user of the shortcuts. However, it is missing a method to remap any of them in this screen. And we had to dig and turn on features to get this far!

But there is something to be noticed about the Gmail shortcuts. In the first screen there is only one shortcut that requires only one key. But the second page has about 36 single character shortcuts. These can interfere with the assistive technology.

For example, the key “l” (lowercase L) inside Gmail will open the “label as” menu. If your screen reader is running, that “l” will bring up a list of lists to jump to. This is because using a browser, the screen reader uses a virtual browser. This mode intercepts all key strokes, provides the screen reader command tied to the key. To use the Gmail shortcut, I need to switch to “Forms” mode. This mode stops the screen reader from intercepting key commands, allowing for easier form completion.

Many ATs use single key and multiple key commands to do their work. Most of the multi-key commands will use the AT’s “special” key. In NVDA this is “Insert” or “caps lock” key. Make certain to avoid those.

Why?

Looking at the success criteria for 2.1.4, we read:

If a keyboard shortcut is implemented in content using only letter (including upper- and lower-case letters), punctuation, number, or symbol characters, then at least one of the following is true:

  • Turn off: A mechanism is available to turn the shortcut off;
  • Remap: A mechanism is available to remap the shortcut to include one or more non-printable keyboard keys (e.g., Ctrl, Alt);
  • Active only on focus: The keyboard shortcut for a user interface component is only active when that component has focus.

Gmail offers the first option to be in compliance. The second is our ideal. This allow the user to set the controls they need the most in a way that works for them.

I personally find the last one interesting. This is akin to hiding the Skip Link until it has focus. But for this to work:

  • The object had tabindex by default or added by the author
  • If I’m focused on the element, it needs to have an active role like button, link, input, etc.
  • All those controls types have standard activation, why not use that

This isn’t to say not to follow the third rule. If you’ve done the work to make the control function as expected, I don’t think a shortcut key is needed.

Summary

Avoid keyboard shortcuts when possible. When it isn’t, avoid AT activation keys. Avoid single key activation. Allow users to remap. Allow users to turn them off. And you can make the keystroke only active when they are in focus.

Come chat on LinkedIn and BlueSky!

Published ina11ya11y 101accessibilityADAblindcognitiondevelopmentEAAEN 301 549hearing impairedhumanityMental Healthphysical impairmentTestingW3CWCAGWeb Content Accessibility Guidelines