Skip to content

nonInteractiveElementInteractions

Reports non-interactive elements with interactive event handlers.

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

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.

<
JSX.IntrinsicElements.h1: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>
h1
DOMAttributes<HTMLHeadingElement>.onClick?: MouseEventHandler<HTMLHeadingElement> | undefined
onClick
={() => {}}>Heading</
JSX.IntrinsicElements.h1: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>
h1
>
<
JSX.IntrinsicElements.main: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
main
DOMAttributes<HTMLElement>.onKeyDown?: KeyboardEventHandler<HTMLElement> | undefined
onKeyDown
={
const handler: any
handler
}>Content</
JSX.IntrinsicElements.main: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
main
>;
<
JSX.IntrinsicElements.img: DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>
img
DOMAttributes<HTMLImageElement>.onClick?: MouseEventHandler<HTMLImageElement> | undefined
onClick
={
const handleClick: any
handleClick
}
ImgHTMLAttributes<HTMLImageElement>.src?: string | undefined
src
="image.png" />;
<
JSX.IntrinsicElements.section: DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
section
DOMAttributes<HTMLElement>.onClick?: MouseEventHandler<HTMLElement> | undefined
onClick
={
const handler: any
handler
}
HTMLAttributes<HTMLElement>.role?: AriaRole | undefined
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 ❤️‍🔥 around the world by the Flint team and contributors.