Non-interactive HTML elements, such as `<div>` and `<span>`, are not designed to have event handlers. When these elements are given event handlers, it can lead to accessibility issues.

## Why is this an issue?

Attaching event handlers to non-interactive HTML elements can lead to significant accessibility issues. These elements, such as `<div>` and `<span>`, are not designed to interact with assistive technologies like screen readers, making it difficult for users with disabilities to navigate and interact with the website. Additionally, these elements may not be focusable or provide visual feedback when interacted with, resulting in a confusing and potentially frustrating user experience. Therefore, to maintain an accessible and user-friendly website, event handlers should be used exclusively with interactive elements.

## How to fix it

To fix this issue, remove the event handler from the non-interactive element and attach it to an interactive element instead. If the element is not interactive, it should not have an event handler.

### Code examples

#### Noncompliant code example

    <li onClick="changeText()" />
    <div onClick="changeText()" role="listitem" />

#### Compliant solution

    <div onClick="changeText()" role="button" />
    <div onClick="changeText()" role="presentation" />
    <input type="text" onClick=changeText() /> <!-- Interactive element does not require role. -->
    <button onClick=changeText() className="foo" /> <!-- button is interactive. -->
    <div onClick=changeText() role="button" aria-hidden /> <!-- This is hidden from the screenreader. -->

## Resources

### Documentation

- WCAG - WAI-ARIA Authoring Practices Guide - Design Patterns and Widgets
- MDN - ARIA Techniques