New
Introducing React Bench, see how different models perform on React code

jsx-a11y/no-static-element-interactions

Require static elements with click or key handlers to declare an interactive role, or be replaced with a semantic element.

Validate the diagnostic

Confirm the reported code matches this rule before you edit it.

Fires when a static element (div, span, etc.) has a configured interactive handler (default: onClick, onMouseDown, onMouseUp, onKeyPress, onKeyDown, onKeyUp) but no role mapping it to an interactive role like button, link, or menuitem. False positive: a wrapper that catches bubbled events from interactive descendants and isn't itself an interaction target — disable with an explanatory comment.

How to fix

Follow the rule guidance while preserving unrelated behavior.

Copyable fix prompt

Copy this self-contained prompt into your coding agent after you confirm the diagnostic.

If the element is an interaction target, use a native semantic element (<button>, <a href>, <input>) — they ship with role, focus, and keyboard support. If you must keep the div, add an appropriate role (role='button', 'link', 'menuitem', 'switch', etc.) plus tabIndex={0} and keyboard handlers so users can reach and activate it. Do not use role='presentation'. See https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/no-static-element-interactions

More Accessibility rules from the rules reference: