accessKeys
Disallow the use of the
accessKey
/accesskey
attribute on JSX elements.
✅ This rule is included in the jsx logical
preset.
The accesskey
attribute historically provides keyboard shortcuts but is unreliable across browsers and can conflict with assistive technologies or built-in browser shortcuts.
Prefer application-level, well-documented keyboard shortcuts and visible UI affordances instead of embedding accesskey
in markup.
Examples
Section titled “Examples”<button accessKey="h">Help</button>
<button>Help</button>
Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you’re working on an internal legacy codebase that is targeted towards specific users, it might be difficult to switch from access key props towards a more comprehensive modern solution. However, whenever possible for production code and libraries, prefer more predictable and discoverable keyboard handling.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
jsx-a11y/no-access-key
- Oxlint:
jsx-a11y/no-access-key
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.