Missing Redundant Event Handlers Check
Description
The “Missing Redundant Event Handlers Check” evaluates whether there is any interactive element with a mouse event handler (like onclick
) that does not include the corresponding keyboard event handler (like onkeypress
, onkeydown
, or onkeyup
).
Example outcome
I identified 1 instance where redundant event handlers are not used.
Impact
- Visual Impairments: Many screen reader users navigate via keyboard. If they can’t trigger mouse-bound actions with the keyboard, they will be locked out of parts of the site.
- Motor Impairments: Users who cannot use a mouse (e.g., due to tremors, paralysis, or limb amputation) and rely on keyboards or assistive tech like switch devices will be unable to activate functionality that’s mouse-only.
Fixes
To address missing redundant event handlers:
- Locate the element that can be triggered by a mouse event but can’t be triggered by a keyboard event.
- Add an attribute (e.g.,
onkeydown
) to allow the triggering with a keyboard event. - If applicable, use a semantic HTML button instead which has built-in keyboard accessibility.