Mouse-specific event handler
(Referring UWEM Test: 6.4_HTML_01)Test info
Failure cause
Found a mouse-specific event handler without a keyboard-specific version
The inspected element uses the mouse-specific event handler
- onmousedown,
- onmouseup,
- onclick,
- onmouseover, or
- onmouseout
but does not provide a keyboard-specific or device-independent event handler that triggers the same functionality.
Why this may be a barrier
Some users don't have a mouse to navigate the page but rely on device-independent keyboard-input. As a result, functionality only provided through mouse-actions is not available to those users.
Good Example
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 //EN">
<html>
<head><title>Sample: Page with mouse-specific event handler WITH A KEYBOARD-SPECIFIC VERSION</title></head>
<body><p onmousedown="alert('This is correct!')" onkeydown="alert('This is correct!')">Some content</p></body>
</html>
Solution
Add a keyboard specific event handler to the inspected element triggering the same functionality the mouse-event does. The following table maps device-specific event handlers:
Mouse-specific Keyboard-specific or device-independent onmousedown onkeydown onmouseup onkeyup onclick onkeypress onmouseover onfocus onmouseout onblur Links with onclick should NOT use onkeypress because that would prevent tabbing through the page.
References
Related WCAG 1.0 Checkpoint
6.4"For scripts and applets, ensure that event handlers are input device-independent." [Priority 2]
WCAG 1.0 Checkpoint 6.4Referring UWEM Test
6.4_HTML_01This test is targeted to check that mouse-specific event handlers have a keyboard specific (or device independent) version.