jsx_a11y/no-access-key Correctness ​
What it does ​
Enforces that the accessKey
prop is not used on any element to avoid complications with keyboard commands used by a screenreader.
Why is this bad? ​
Access keys are HTML attributes that allow web developers to assign keyboard shortcuts to elements. Inconsistencies between keyboard shortcuts and keyboard commands used by screenreaders and keyboard-only users create accessibility complications so to avoid complications, access keys should not be used.
Example ​
Examples of incorrect code for this rule:
jsx
<div accessKey="h" />
Examples of correct code for this rule:
jsx
<div />
How to use ​
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny jsx-a11y/no-access-key --jsx-a11y-plugin
json
{
"plugins": ["jsx-a11y"],
"rules": {
"jsx-a11y/no-access-key": "error"
}
}