Skip to content

nonInteractiveElementInteractions

Reports non-interactive elements with interactive event handlers.

✅ This rule is included in the jsx logical preset.

Non-interactive HTML elements and non-interactive ARIA roles indicate content and containers in the user interface. These elements should not have interactive event handlers because they are not designed to be interactive.

Non-interactive elements include <main>, <area>, <h1> through <h6>, <p>, <img>, <li>, <ul>, and <ol>. Non-interactive ARIA roles include article, banner, complementary, img, listitem, main, navigation, region, and tooltip.

When you need to add interactivity, use native interactive elements like <button> or <a>, or add an appropriate interactive role to the element.

This is required for WCAG 4.1.2 compliance.

<h1 onClick={() => {}}>Heading</h1>
<main onKeyDown={handler}>Content</main>
<img onClick={handleClick} src="image.png" />
<section onClick={handler} role="article" />

If you are using a framework that automatically handles accessibility for non-interactive elements with event handlers, you can disable this rule.

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