src/content/docs/linter/rules/use-focusable-interactive.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v1.8.0` - Diagnostic Category: [`lint/a11y/useFocusableInteractive`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`jsx-a11y/interactive-supports-focus`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/interactive-supports-focus.md){
"linter": {
"rules": {
"a11y": {
"useFocusableInteractive": "error"
}
}
}
}
Elements with an interactive role and interaction handlers must be focusable.
HTML elements with interactive roles must have tabIndex defined to ensure they are
focusable. Without tabIndex, assistive technologies may not recognize these elements as
interactive.
You could also consider switching from an interactive role to its semantic HTML element
instead.
<div role="button" />
<div role="tab" />
<div role="button" tabIndex={0} />
<div />