Specify logical event handlers |
WAI / WCAG 1.0 Priority 2 checkpoint 9.3
Issue Description The page contains BUTTON, INPUT, SELECT or TEXTAREA elements that specify event handlers that are device dependent (i.e. they handle events that can be generated by a specific input device.)
How to fix In general, it is best to substitute event handlers within forms as follows: on INPUT (type=submit or type=reset or type=image) or BUTTON remove events handlers like ONCLICK, ONDBLCLICK, ONKEYPRESS, ONKEYDOWN, ONKEYUP, ONMOUSEDOWN, ONMOUSEUP and add ONRESET (if type=reset) or ONSUBMIT to the entire form; on checkboxes and radiobuttons, remove handlers for ONCLICK, ONDBLCLICK, ONKEYPRESS, ONKEYDOWN, ONKEYUP, ONMOUSEDOWN, ONMOUSEUP and add ONCHANGE (to the radiobutton or checkbox); on text fields, replace handlers for ONCLICK, ONDBLCLICK, ONMOUSEDOWN, ONMOUSEUP with ONFOCUS; on SELECT lists, replace handlers for ONCLICK, ONDBLCLICK, ONMOUSEDOWN, ONMOUSEUP with ONCHANGE.
Issue Explanation The user interface offered by a web page should be perceivable and operable by everyone, regardless of physical, cognitive or technical disabilities. In particular it must be device-independent. This is crucial for pages that include forms. As defined by W3C/WAI (see Web Content Accessibility Guidelines 1.0 [http://www.w3.org/TR/WCAG10/wai-pageauth.html#gl-interim-accessibility#device-independent] ), "device independence" means that visitors must be able to interact with a website using the supported input and output devices of their choice and according to their needs. Input devices may include pointing devices, keyboards, Braille devices, head wands, microphones, and others. Output devices may include monitors, speech synthesizers, and Braille devices. Note that "device-independent support" does not mean that the browser must support every input or output device. It should offer redundant input and output mechanisms for those devices that are supported. For example, if a browser supports keyboard and mouse input, users should be able to interact with all features using either the keyboard or the mouse. Device-independent access means that the visitor may interact with the browser or document with a preferred input (or output) device. For example, if a form control can only be activated with a mouse or other pointing device, someone using the page without sight, with voice input, or with a keyboard will not be able to use the form. The form is an example of device dependence, because its use would be possible only through a mouse. Generally, pages that allow keyboard interaction are also accessible through speech input or a command-line interface.