accesskey: why duplicate shortcuts break and how to check
Two elements claiming the same accesskey means one shortcut is unreachable. squirrel lists every duplicated access key on every page.
What accesskey is
accesskey asks the browser to bind a keyboard shortcut to an element. The modifier combination is chosen by the browser and the platform, not by the page, so the same markup produces different key presses on Windows, macOS and Linux.
The attribute is rarely worth using. Its values collide with browser and screen reader shortcuts that users already rely on, and the binding stays invisible unless the page spells it out somewhere. When it is used, each value has to be unique: if two elements claim the same key, which one the shortcut reaches is left to the browser.
What squirrel checks
One check, at severity warning. It collects every element carrying an accesskey attribute, matching the attribute name case-insensitively, and lowercases each value before comparing.
accesskeys-uniquewarns when a value is claimed by more than one element. Report message:N duplicate access key(s) found. Each item names the value and its claimants, for exampleaccesskey="s" used by: button#save, a#search.accesskeyspasses withN access key(s) are unique.accesskeysreturns info withNo access keys definedwhen the page has none.
How to fix it
<button accesskey="s">Save</button>
<a href="/search" accesskey="f">Find</a>Give each element a distinct character, or remove the attribute. Dropping accesskey entirely is a legitimate fix, since landmarks and a skip link cover the same navigation need without stealing key presses.
| Rule ID | a11y/accesskeys |
| Category | Accessibility |
| Scope | Per-page |
| Severity | warning |
| Weight | 4/10 |
Enable / disable
Disable this rule
[rules]
disable = ["a11y/accesskeys"]Disable all Accessibility rules
[rules]
disable = ["a11y/*"]Enable only this rule
[rules]
enable = ["a11y/accesskeys"]enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.
Related rules
- a11y/skip-link: the bypass mechanism that replaces most uses of
accesskey. - a11y/tabindex: the other attribute that overrides default keyboard behavior.
- a11y/duplicate-id-active: duplicate identifiers on focusable elements.
- a11y/landmark-regions: whether the page has
main,navandfooterlandmarks to navigate by instead.
Accessibility findings ship in every audit next to the SEO, performance and agent experience rules. See Website security scan with AI for how an agent works through a report.
References
Check your site
Run squirrel audit https://example.com and open the Accessibility section of the report. Each duplicated key is listed with every element claiming it. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.