onClick Event Handler must be on Focusable Element

Overview

Popular browsers support both keyboard and mouse activation of onClick event handlers. Browser keyboard support of the onClick event handler is dependent on the event handlers being part of elements that the browser can give keyboard focus. These elements include a, input, select, textarea and button elements. Assistive technologies require that the onClick event handler is an attribute of the focusable element and not rely on event bubbling to respond to keyboard events.

Benefit to People with Disabilities

  1. People with disabilities can use keyboard commands to activate onClick event handlers that are compatible with assitive technologies.

Benefits to All Users

  1. All users will benefit from being able to use keyboard commands in addition to mouse clicks to activate onClick event handlers, especailly touch typists ho do not like to take the fingers off the home keys.

Benefits to Developers

  1. Developers benefit from having cleaner more readable code and providing users with multiple ways to interact with there web resources.

HTML Markup Details

onclick attribute
The onclick event is often used to create link type behaviors.

Related Accessibility Requirements

Illinois Information Technology Accessibility Standards
13.1 Ensure that scripted functions are usable with assistive technologies.
13.2 Ensure that significant interactions can be performed with both keyboard and mouse.
Section 508
1194.21 (a) When software is designed to run on a system that has a keyboard, product functions shall be executable from a keyboard where the function itself or the result of performing a function can be discerned textually.
1194.21 (l) When electronic forms are used, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues.
1194.22 (l) When pages utilize scripting languages to display content, or to create interface elements, the information provided by the script shall be identified with functional text that can be read by assistive technology.
1194.22 (n) When electronic forms are designed to be completed on-line, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues.
W3C Web Content Accessibility Guidelines 2.0
2.1.1 Keyboard
2.1.2 No Keyboard Trap
2.1.3 Keyboard (No Exception)
Web Content Accessibility Guidelines (WCAG 1.0)
6.4 For scripts and applets, ensure that event handlers are input device-independent. [Priority 2]
8.1 Make programmatic elements such as scripts and applets directly accessible or compatible with assistive technologies. [Priority 1 if functionality is important and not presented elsewhere, otherwise Priority 2]
9.3 For scripts, specify logical event handlers rather than device-dependent event handlers. [Priority 2]