Elements With Pointer Event Handlers Missing Keyboard Event Handlers
WCAG Focus: WCAG 2.1.1 (A)
WordPress themes and interactive plugins frequently attach mouse-only handlers such as onclick, onmousedown, or onmouseover to elements without pairing them with keyboard event listeners like onkeydown or onkeypress. Users navigating solely with a keyboard, switch device, or screen reader cannot trigger those interactions.
Why This Pattern Violates WCAG
WCAG 2.1.1 Keyboard (Level A) requires all functionality of the content to be operable through a keyboard interface without requiring specific timings for individual keystrokes.
Pairing mouse-only events with native <button> or <a> elements—or explicit keyboard handlers—ensures parity for non-pointer users.
Code Comparison
Inaccessible Mouse-Only Event Handler
<div onclick="toggleDetails()" onmouseover="highlightCard()">View Details</div>
Compliant Native Button With Keyboard & Focus Support
<button type="button" onclick="toggleDetails()">View Details</button>
How to Fix It in WordPress
- Replace clickable <div> or <span> triggers with native <button type="button"> or <a href="…"> elements whenever possible.
- Where custom event handlers are required, pair onclick/onmousedown with onkeydown/onkeypress handling Enter and Space, and pair onmouseover with onfocus.
Finding This Issue Automatically
Mouse-only event attributes are easy to overlook when testing exclusively with a trackpad. The WP ADA Compliance Check plugin flags pointer-only handlers during scans and can automatically fix the issue by adding an onkeypress keyboard event handler to elements that include only mouse handlers such as onclick.
WCAG References & Supporting Materials
WCAG Success Criteria
Supporting Documentation & Guides
- W3C Failure F54: Using only pointing-device-specific event handlers — Covers mouse-only handlers lacking keyboard equivalents under WCAG 2.1.1.
- W3C Technique G90: Providing keyboard-triggered event handlers — Shows how interactive JavaScript controls must respond to keyboard input.
- W3C ARIA Authoring Practices: Developing a Keyboard Interface — Keyboard focus, activation keys, and event handler implementation rules.
Subscribe
Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

