no-accesskey-attrs

This rule disallows the use of the accesskey attributes.

Why?

The accesskey attribute allows developers to assign keyboard shortcuts to elements. However, these shortcuts can conflict with screen readers or keyboard-only navigation, leading to accessibility issues. To prevent such problems, the use of accesskey is discouraged.

How to use

.eslintrc.js
module.exports = {
  rules: {
    "@html-eslint/no-accesskey-attrs": "error",
  },
};

Rule Details

Examples of incorrect code for this rule:

<div accesskey="h"></div>

Examples of correct code for this rule:

<div></div>

Further Reading

  1. MDN: accesskey