Checkpoint 1.3 - Java
All custom components explicitly implement the Accessible interface
WCAG 1.0 Priority 1
WCAG Guideline 8. Ensure direct accessibility of embedded user interfaces.
The Accessible interface needs to be applied to the class file to let assistive technologies know that the Accessibility API has been implemented.
Requirement
All custom components explicitly implement the Accessible interface
Recommendation
All custom components should extend a standard class as far down the JFC/Swing inheritance hierarchy as possible. All standard JComponent subclasses implement this interface and do everything necessary to be accessible.
The Accessible interface has only one method call: getAccessibleContext() and returns an instance of AccessibleContext. The returned information provides the information and functionality to enable accessibility, including:
- information about the component's role (button, checkbox, etc.)
- accessible name
- number of children, and more
- ability to generate accessibility events when a noteworthy event has occurred.
The following Java code example shows how the Accessible is implemented on a custom component:
import java.awt;
import javax.accessibility;
class MyButton implements Accessible extends Component {
AccessibleContext getAccessibleContext() {
...
}
}
Checking Tool
Review the source code of the applet/application to ensure the Accessible interface has been implemented on custom components.
Information Source
The original source of this information is located on the W3C web site (www.w3.org/TR/WCAG10-TECHS/#gl-own-interface)