jsx-a11y/no-access-key
Disallow the accessKey attribute
has suggestions
Also called jsx_a11y/no-access-key
accessKey adds a keyboard shortcut to an element. Screen readers and browsers already use many key combinations, and they differ from one to the next, so your shortcut can take over a command that a keyboard user depends on.
The attribute is reported on any element or component, no matter how it's capitalized.
--fix-suggestions removes the attribute.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"jsx-a11y/no-access-key" = "error" # or "warn"Examples#
example.jsx2 problems
const save = <button accessKey="s"No access key attribute allowed.>Save</button>;
const open = <MenuItem accesskey="o"No access key attribute allowed. />;example.jsxNo problems
const save = <button>Save</button>;
const open = <MenuItem />;