onClick Event Handler must be on Focusable Element
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
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.
Benefits to People with Disabilities
- People with disabilities can use keyboard commands to activate onClick event handlers that are compatible with assitive technologies.
Benefits to Everyone
- All users will benefit from being able to use keyboard commands in addition to mouse clicks to activate
onClickevent handlers, especailly touch typists who do not like to take the fingers off the home keys.
Benefits to Developers
- Developers benefit from having cleaner more readable code and providing users with multiple ways to interact with there web resources.
onclickattribute is used to add interaction behaviors to web pages
onclickshould only be used on elements that can receive input focus
Related Accessibility Requirements
- § 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.