src/content/docs/linter/rules/no-interactive-element-to-noninteractive-role.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v1.3.0` - Diagnostic Category: [`lint/a11y/noInteractiveElementToNoninteractiveRole`](/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-interactive-element-to-noninteractive-role`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-interactive-element-to-noninteractive-role.md){
"linter": {
"rules": {
"a11y": {
"noInteractiveElementToNoninteractiveRole": "error"
}
}
}
}
Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements.
Interactive HTML elements indicate controls in the user interface.
Interactive elements include <a href>, <button>, <input>, <select>, <textarea>.
Non-interactive HTML elements and non-interactive ARIA roles indicate content and containers in the user interface.
Non-interactive elements include <main>, <area>, <h1> (,<h2>, etc), ``, <li>, <ul> and <ol>.
WAI-ARIA roles should not be used to convert an interactive element to a non-interactive element.
Non-interactive ARIA roles include article, banner, complementary, img, listitem, main, region and tooltip.
<input role="img" />;
<input role="button" />;
<canvas role="img" />;