Web Development
Web Developer Guidelines
Visual Design Recommendations

Checkpoint 1.6 - Java

All objects are implemented using the AccessibleName method

WCAG 1.0 Priority 2

WCAG Guideline 12. Provide context and orientation information.

An object's name is a succinct explanation of the object's purpose. Names of objects can be made available to assistive technologies by implementing the AccessibleName method. When implemented, an assistive technology will often present (e.g., speak) the name of each object encountered by a user.

Requirement

All objects are implemented using AccessibleName method

Recommendation

If AccessibleName has not been implemented for an image icon, a screen reader will read "Image button", reading out the type of control, but not the name of the control.

Do not give multiple objects the same name where the intended meaning is different.

When using the standard JFC/Swing! components, objects containing non-editable text will have their accessible names set automatically. Examples of these types of objects are menu items, buttons, radio boxes, and items in a list. However, some objects contain no static text and must have their names set by the developer.

If the object on the screen has a label associated with it, label the object with an instance of JLabel and use setLabelFor() to set the correct properties in the AccessibleContexts. This association is important because changes to the label automatically propagate to the assistive technology:

JTextField text = new JTextField(20);
JLabel label = new Label("Address Line 1");
label.setLabelFor(text);
// ... Add the text and label to a Container
      

Other objects do not have labels and require that the programmer set the name explicitly. For ImageIcon objects, a constructor exists that can be used to set the name:

ImageIcon(URL url, String name);
      

Checking Tool

Test with the screen reader to verify controls and objects are read. Tab or arrow to objects and controls on the screen. Make sure the screen reader reads label and object information. The screen reader will read the name of the object, such as the text on a button or text associated with a image button.

Information Source

The original source of this information is located on the W3C web site  (www.w3.org/TR/WCAG10-TECHS/#tech-unassociated-labels)

 

Back to top