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.
The rule only considers the handlers onClick
, onMouseDown
, onMouseUp
, onKeyPress
,
onKeyDown
, and onKeyUp
.