noAccessKey (HTML)
Summary
Section titled “Summary”- Rule available since:
v2.4.0 - Diagnostic Category:
lint/a11y/noAccessKey - This rule is recommended, meaning it is enabled by default.
- This rule has an unsafe fix.
- The default severity of this rule is error.
- Sources:
- Inspired from
jsx-a11y/no-access-key - Same as
@html-eslint/no-accesskey-attrs
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "noAccessKey": "error" } } }}Description
Section titled “Description”Disallow the accesskey attribute.
accesskey assigns a keyboard shortcut to an element. The shortcut can conflict with browser,
operating-system, or screen-reader commands, and the activation keys differ between browsers.
Remove the attribute and provide keyboard access through standard interactive elements.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<input type="submit" accesskey="s" value="Submit" />code-block.html:1:22 lint/a11y/noAccessKey FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid the accesskey attribute to reduce inconsistencies between keyboard shortcuts and screen reader keyboard commands.
> 1 │ <input type="submit" accesskey="s" value="Submit" />
│ ^^^^^^^^^^^^^
2 │
ℹ Assigning keyboard shortcuts using the accesskey attribute leads to inconsistent keyboard actions across applications.
ℹ Unsafe fix: Remove the accesskey attribute.
1 │ <input·type="submit"·accesskey="s"·value="Submit"·/>
│ --------------
<a href="https://webaim.org/" accesskey="w">WebAIM.org</a>code-block.html:1:31 lint/a11y/noAccessKey FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid the accesskey attribute to reduce inconsistencies between keyboard shortcuts and screen reader keyboard commands.
> 1 │ <a href="https://webaim.org/" accesskey="w">WebAIM.org</a>
│ ^^^^^^^^^^^^^
2 │
ℹ Assigning keyboard shortcuts using the accesskey attribute leads to inconsistent keyboard actions across applications.
ℹ Unsafe fix: Remove the accesskey attribute.
1 │ <a·href="https://webaim.org/"·accesskey="w">WebAIM.org</a>
│ -------------
<button accesskey="n">Next</button>code-block.html:1:9 lint/a11y/noAccessKey FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid the accesskey attribute to reduce inconsistencies between keyboard shortcuts and screen reader keyboard commands.
> 1 │ <button accesskey="n">Next</button>
│ ^^^^^^^^^^^^^
2 │
ℹ Assigning keyboard shortcuts using the accesskey attribute leads to inconsistent keyboard actions across applications.
ℹ Unsafe fix: Remove the accesskey attribute.
1 │ <button·accesskey="n">Next</button>
│ -------------
<button>Next</button>Resources
Section titled “Resources”Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.