squirrelscan
GitHub

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-unique warns 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 example accesskey="s" used by: button#save, a#search.
  • accesskeys passes with N access key(s) are unique.
  • accesskeys returns info with No access keys defined when 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 IDa11y/accesskeys
CategoryAccessibility
ScopePer-page
Severitywarning
Weight4/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.

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.

Type to search…

↑↓ navigate↵ openesc close