Provide role name for div/span with event handler [F59]

Test info
Possible Results

Test info

Test for Success Criterion 4.1.2

About

Checked Elements: div or span elements
This test checks if event handlers to elements are attached to div and span, a role name is also defined for them.

Short Description

Assistive technologies rely on knowledge of the role and current state of a component in order to provide that information to the user. Many HTML elements have well defined roles, such as links, buttons, text fields, etc. Generic elements such as div and span do not have any predefined roles. When these generic elements are used to create user interface controls in HTML the assistive technology may not have the necessary information to describe and interact with the control. Attaching event handlers to elements that are not normally interactive, such as span and div, can be disorienting to users. Even if care is taken to provide keyboard access to such elements, users may have a difficult time discovering that there are interactive controls in the content or understanding what type of behavior to expect from them.

WCAG 2.0

Principle 4: Robust
Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies.
WCAG 2.0: Principle 4
Guideline 4.1: Compatible:
Maximize compatibility with current and future user agents, including assistive technologies.
Understanding Guideline 4.1
Success Criterion 4.1.2: Name, Role, Value (Level A)
For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined ; states, properties, and values that can be set by the user can be programmatically set ; and notification of changes to these items is available to user agents , including assistive technologies . Note: This success criterion is primarily for Web authors who develop or script their own user interface components. For example, standard HTML controls already meet this success criterion when used according to specification.
Understanding: Success Criterion 4.1.2
Techniques

Possible Results

Failed Using script on div or span with role name

Using script to make div or span a user interface control in HTML without providing a role for the control

Passed div or span has role name

Scripts are used on div or span controls where there is a role name for div or span