Skip to content

interactiveElementsFocusable

Reports interactive elements that are not focusable via keyboard.

✅ This rule is included in the jsx logical and logicalStrict presets.

Elements with interactive roles and event handlers must be focusable. Users navigating with keyboards need to be able to reach all interactive elements. When interactive elements are not focusable, they become inaccessible to keyboard-only users.

This rule reports elements that have interactive roles (like button, link, etc.) and event handlers but lack a way to be focused via keyboard - either through being inherently focusable (like <button>) or having an explicit tabIndex attribute.

<
any
div
role: string
role
="button"
onClick: () => void
onClick
={() => {}} />
<
any
span
role: string
role
="link"
onClick: () => void
onClick
={() => {}} />
<
any
div
role: string
role
="checkbox"
onClick: () => void
onClick
={() => {}} />
<
any
div
role: string
role
="menuitem"
onKeyDown: () => void
onKeyDown
={() => {}} />

If you are using a framework that automatically manages focus for interactive elements, you may want to disable this rule.

Made with ❤️‍🔥 around the world by the Flint team and contributors.