Skip to content

staticElementInteractions

Reports static elements with event handlers that lack ARIA roles.

✅ This rule is included in the jsx logical preset.

Static HTML elements like <div> and <span> have no semantic meaning. When adding interactive event handlers to these elements, you should provide a role attribute to convey their purpose to screen readers, search engine crawlers, and other technologies that rely on semantic elements.

Semantic HTML elements like <button> already have appropriate roles and don’t need additional attributes.

This is required for WCAG 4.1.2 compliance.

<div onClick={() => {}} />
<span onKeyDown={handler} />

If you are using a framework that automatically assigns element roles, you can disable this rule.

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