accesskeys
Web validation
accesskey attribute values should be unique.The accesskey attribute tells browsers and assistive technology to create keyboard shortcuts that move focus to, or activate, interactive elements. When two elements share the same value, keystrokes can trigger the wrong control or do nothing at all.
Duplicate shortcuts can confuse keyboard and screen reader users and slow down navigation. Because support is inconsistent, use accesskey only when strictly necessary and always ensure each value is distinct.
Pass Patterns
Each access key is unique
<a href="https://example.com" accesskey="g">Go to Example</a>
<button accesskey="s">Save</button>Fail Patterns
Two elements reuse the same access key
<a href="https://example.com" accesskey="g">Go to Example</a>
<button accesskey="g">Save</button>Try It Yourself
Using a keyboard
- In your browser, press the access-key modifier, for example, Alt (Chrome, Edge, Safari, Opera) or Alt + Shift (Firefox) on Windows, Ctrl + Option on macOS, plus the assigned character key.
- Observe which element receives focus or is activated.
Expected results: Focus moves to, or the browser activates, the element whose unique accesskey attribute you pressed.
Actual results: If duplicate values exist, the shortcut may select the wrong element or fail entirely.
FAQ
Why is this rule considered a best practice?
HTML permits duplicate accesskey attribute values, but doing so degrades keyboard and screen reader usability. Ensuring uniqueness prevents focus conflicts and aligns with widely accepted accessibility guidance, even though no single WCAG success criterion directly addresses it.
Why is this issue marked as Serious?
Conflicting shortcuts stop some people with disabilities from operating the interface efficiently, especially those who rely on the keyboard. The problem is reproducible in mainstream browsers and assistive technologies, and can block essential tasks.