src/content/docs/linter/rules/no-access-key.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v1.0.0` - Diagnostic Category: [`lint/a11y/noAccessKey`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`jsx-a11y/no-access-key`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-access-key.md){
"linter": {
"rules": {
"a11y": {
"noAccessKey": "error"
}
}
}
}
Enforce that the accessKey attribute is not used on any HTML element.
The accessKey assigns a keyboard shortcut to the current element. However, the accessKey value
can conflict with keyboard commands used by screen readers and keyboard-only users, which leads to
inconsistent keyboard actions across applications. To avoid accessibility complications,
this rule suggests users remove the accessKey attribute on elements.
<input type="submit" accessKey="s" value="Submit" />
<a href="https://webaim.org/" accessKey="w">WebAIM.org</a>
<button accessKey="n">Next</button>
{
"linter": {
"rules": {
"a11y": {
"noAccessKey": "error"
}
}
}
}
Enforce that the accesskey attribute is not used on any HTML element.
The accesskey assigns a keyboard shortcut to the current element. However, the accesskey value
can conflict with keyboard commands used by screen readers and keyboard-only users, which leads to
inconsistent keyboard actions across applications. To avoid accessibility complications,
this rule suggests users remove the accesskey attribute on elements.
<input type="submit" accesskey="s" value="Submit" />
<a href="https://webaim.org/" accesskey="w">WebAIM.org</a>
<button accesskey="n">Next</button>