accesskeys
accesskey values must be unique
Checks that no two elements on the page share the same accesskey attribute value.
Applies to. Applies whenever two or more elements carry a non-empty accesskey attribute: only then can two of them collide.
Expectation. Every accesskey value on the page is unique. Duplicate accesskeys make keyboard-shortcut activation ambiguous: only one of the elements sharing the key can actually be reached by it, and which one is browser/platform-dependent.
What a finding reports.
accesskey: the shared key, in lower case.duplicateCount: how many elements on the page share it, this one included.
These data.details fields help to read and reproduce a finding. Apart from reasonCode and the few fields Output schema names as stable, they are not a stable contract: a field may be renamed or dropped in a minor release, so don’t build on them.
Examples
<a href="/a" accesskey="a">A</a><a href="/b" accesskey="b">B</a>
Every accesskey value on the page is unique.
<a href="/s1" accesskey="s">S1</a><a href="/s2" accesskey="s">S2</a>
Two elements share the same accesskey value ("s"), which most browsers resolve unpredictably.
How to check
When this rule can’t decide, it reports cantTell and leaves the question to a person. Each question it can ask is listed here under its reason code, with the steps to answer it. A finding carries the same steps as howToCheck, in the scan’s language. See Output schema.
ACCESSKEY_DUPLICATE
- Note the access key the report names and find the other elements sharing it.
- Press the browser's access key combination with that key (for example Alt, or Alt+Shift, plus the key) and note which element is focused or activated.
- Press it again and check whether each element sharing the key can be reached.
Pass. Each element with that key can be reached by it, or the duplicates are intended and harmless.
Fail. Only one of the elements responds to the key, so the others cannot be reached by their shortcut (best practice, related to WCAG 2.1.1).