Maximize compatibility with current and future user agents, including assistive technologies.
Code must as clean as possible, as well as it must respect the standards. In this way, browsers will be able to render the page.
4.1.1 Parsing Level A
In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features.
- Validate Web pages
- Fully conform to specifications
- Use HTML according to spec
- Ensure that Web pages can be parsed by ensuring that opening and closing tags are used according to specification pr that Web pages are well-formed
- Incorrect use of start and end tags or attribute markup
- Duplicating values of type ID
- Insufficient information in DOM to determine one-to-one relationships (e.g., between labels with same id) in HTML
- Insufficient information in DOM to determine specific relationships in XML
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.
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.
If using a standard user interface component in a markup language
- Use markup features to expose the name and role, allow user-settable properties to be directly set, and provide notification of changes using:
- HTML form controls and links
- Label elements to associate text labels with form controls
- the title attribute of the frame and iframe elements
- the title attribute to identify form controls when the label element cannot be used
- HTML according to spec
- Using functions of the Document Object Model (DOM) to add content to a page
If using script or code to re-purpose a standard user interface component in a markup language
- Expose the names and roles, allowing user-settable properties to be directly set, and providing notification of changes using functions of the Document Object Model to add content to a page
If using a standard user interface component in a programming technology
- Use the accessibility API features of a technology to expose names and roles, to allow user-settable properties to be directly set, and to provide notification of changes
If creating your own user interface component in a programming language
- Create components using a technology that supports the accessibility API features of the platforms on which the user agents will be run to expose the names and roles, allow user-settable properties to be directly set, and provide notification of changes
- Providing labels for all form controls that do not have implicit labels
- Using script to make div or span a user interface control in HTML.
- Implementing custom controls that do not use an accessibility API for the technology, or do so incompletely
- Not updating text alternatives when changes to non-text content occur
- The association of label and user interface controls not being programmatically determinable
- The focus state of a user interface component not being programmatically determinable or no notification of change of focus state available
- Not providing names for each part of a multi-part form field
- Using null alt on an image where the image is the only content in a link