Rule
Duplicate access keys
The same accesskey must not be assigned twice.
- Rule
accesskeys- Type
- Best practice, not a WCAG requirement. It runs when Best practices is switched on.
- Severity
- Serious
What it checks
The rule collects every element with an accesskey attribute and compares the values, ignoring case and surrounding spaces. When two or more elements share a key, each of them fails.
A browser can act on only one element per key, so the others do nothing when the key is pressed. Access keys can also clash with the shortcuts of a screen reader or the browser itself, so a person who relies on the keyboard may trigger the wrong thing.
Example
Fails
<nav aria-label="Main">
<a href="/search" accesskey="s">Search</a>
<a href="/settings" accesskey="s">Settings</a>
</nav>
Passes
<nav aria-label="Main">
<a href="/search" accesskey="s">Search</a>
<a href="/help" accesskey="h">Help</a>
</nav>
The engine is tested against both examples.
How to fix it
Give each element its own key, or remove the accesskey attributes and rely on links and landmarks that are easy to reach.
Check your own pages
This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.