Skip to content

interactiveElementsFocusable

Reports interactive elements that are not focusable via keyboard.

✅ This rule is included in the jsx logical preset.

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.

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

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

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.