Further script accessibility improvements
There are a range of input methods usable on the web, including keyboards, mice and speech. Scripts and applets, especially those which provide content, should not require a particular input device.
Web Accessibility Initiative Guidelines
This page explains how to meet:
- Guideline 6.4:
"For scripts and applets, ensure that event handlers are input device-independent"
- Guideline 8.1:
"Make programmatic elements such as scripts and applets directly accessible or compatible with assistive technologies"
- Guideline 9.2:
"Ensure that any element that has its own interface can be operated in a device-independent manner."
- Guideline 9.3:
"For scripts, specify logical event handlers rather than device-dependent event handlers."
Reasons for following these recommendations
Where a script or applet is vital to the functionality of the page, an accessible alternative must be provided to meet the Priority 1 Recommendations. If the functionality is less vital, it is still important that the script or applet be as compatible as possible with a wide range of browsers.
One way to achieve greater accessibility is to use device-independent event handlers. This ensures that the user is not required to have a mouse, or a keyboard, to use the page.
How to use device-independent event handlers.
The scripting events
and so on require the use of a mouse or keyboard. However, several
elements support the use of device-independent events:
onfocus- activates when the element is focused on, by a mouse click, by pressing tab to select it, or by some other method.
onblur- activates when the element loses focus as another element is focused on.
onselect- activates when text is selected.
onchange- activates when the content is changed between focusing and blurring.
onsubmit- activates when a form is submitted.
onreset- activates when a form is reset.
One or more of these events is supported by the
Purely decorative scripts, such as image rollovers that do not convey additional content, do not need to meet this requirement.
Automatic checking of this is difficult, although some checkers will detect the presence of device-dependent events, and warn about this. Try to use any scripts present with only a mouse, and then only a keyboard. If you have any other input devices, test with those as well. If the script is unusable with a particular input device, make the necessary changes.