src/content/docs/linter/rules/no-noninteractive-element-to-interactive-role.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/noNoninteractiveElementToInteractiveRole`](/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-noninteractive-element-to-interactive-role`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-to-interactive-role.md){
"linter": {
"rules": {
"a11y": {
"noNoninteractiveElementToInteractiveRole": "error"
}
}
}
}
Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements.
Non-interactive HTML elements indicate content and containers in the user interface.
Non-interactive elements include <main>, <area>, <h1> (,<h2>, etc), ``, <li>, <ul> and <ol>.
Interactive HTML elements indicate controls in the user interface.
Interactive elements include <a href>, <button>, <input>, <select>, <textarea>.
WAI-ARIA roles should not be used to convert a non-interactive element to an interactive element.
Interactive ARIA roles include button, link, checkbox, menuitem, menuitemcheckbox, menuitemradio, option, radio, searchbox, switch and textbox.
<h1 role="button">Some text</h1>
<span role="button">Some text</span>