no-accesskey-attrs

This rule disallows use of accesskey attributes.

Why?

accesskey attributes allow web developers to assign keyboard shortcuts to elements. Inconsistencies between keyboard shortcuts and keyboard commands used by screenreader and keyboard only users create accessibility complications so to avoid complications, access keys should not be used.

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