Understanding WCAG SC 2.1.4 Character Key Shortcuts
Version and Level: 2.1/2.2 (Level A)

Success Criterion 2.1.4 Character Key Shortcuts ensures that if a keyboard shortcut is implemented using single characters, there must be a way to turn it off, remap it, or ensure it is only active when the component has focus. This is crucial for users who rely on assistive technologies or have motor disabilities.

Benefits:

  1. Prevent conflicts with assistive technologies: Prevent conflicts with assistive technologies such as screen readers and speech recognition software.
  2. Allow management or disabling of shortcuts: Allow users to manage or disable shortcuts, avoiding accidental triggers.
  3. Ensure single-key shortcuts do not interfere: Ensure that single-key shortcuts do not interfere with user input, particularly for those using speech input.

Main Objective:

To avoid conflicts between assistive technologies and a website's custom shortcuts, provide users with control over single-character key shortcuts, ensuring they can either turn them off, remap them, or activate them only when the component is focused.

When users using assistive technologies navigate the website, their assistive technologies offer shortcuts to operate the software better. For example, using the 'H' key allows blind users utilizing screen readers to move directly through all headings of the website. If a website uses the 'H' key for hiding specific content, a conflict will occur. The screen reader user may not be able to use the navigation shortcut and may instead hide specific elements, causing confusion.

The same issue may occur when users with motor disabilities utilize their speech-to-text software. As they may spell out characters to opt for specific actions on the page, they may accidentally trigger an embedded customized command installed by the website, causing confusion and a complicated experience.

Best Practices:

  • Avoid single-character key shortcuts: Avoid using single-character key shortcuts if possible.

  • Provide a mechanism to turn off single-character key shortcuts: Provide a mechanism to turn off single-character key shortcuts.

  • Design shortcuts using non-printable key combinations: Design keyboard shortcuts using combinations of non-printable keys (e.g., Ctrl + K, Alt + N).

  • Ensure shortcuts are focus-specific: Ensure that shortcuts are only active when the relevant component has keyboard focus.

Examples & Explanation:

Example: Ensuring a user can navigate out of an interactive map using a keyboard

What Should Be Avoided

An email client uses single-character shortcuts such as 'R' to reply, 'D' to delete, and 'S' to send emails. These shortcuts are always active, regardless of whether the user is in the inbox or composing an email.

Explanation: Users with motor disabilities who utilize text-to-speech software may accidentally trigger shortcuts while composing emails by speech. If they spell the letter 's', they may accidentally send an email while still composing it.

What Should Be Done

HTML/CSS

              <button id="toggle-shortcuts">Turn on Shortcuts</button>
              <div id="email-client">
                <!-- Email client content -->
              </div>
              <script>
                let shortcutsEnabled = true;
                
                document.getElementById('toggle-shortcuts').addEventListener('click', () => {
                  shortcutsEnabled = !shortcutsEnabled;
                });
              
                document.addEventListener('keydown', (e) => {
                  if (shortcutsEnabled) {
                    if (e.key === 'R') {
                      // Reply action
                    } else if (e.key === 'D') {
                      // Delete action
                    } else if (e.key === 'S') {
                      // Star action
                    }
                  }
                });
              </script>
                

Explanation: The toggle button allows users to enable or disable single-character shortcuts, preventing accidental triggers when they are not desired. When a user utilizing text-to-speech software navigates the page, they will notice the button and can deactivate the shortcut mechanism, allowing them to compose an email without any barrier or conflict. This approach ensures that shortcuts are only active when the user intends to use them.

Next Up

Enhance your understanding with SC 2.2.1 - Timing Adjustable. Learn to make timing adjustments accessible for all users.

Go to SC 2.2.1