All HTML pages
This technique relates to Success Criterion 4.1.1: Parsing (Sufficient, together with H74: Ensuring that opening and closing tags are used according to specification and H94: Ensuring that elements do not contain duplicate attributes as a way to meet an unwritten technique).
The objective of this technique is to avoid key errors that are known
to cause problems for assistive technologies when they are trying to
parse content that has the same
id attribute on different elements.
These errors can be avoided by making sure the Web page does not have
id values. This can be done manually or by using HTML's mechanism
to specify the technology and technology version, and validating the
document for this condition. There are several validators that the
developer can use; validation reports generally mention this type of
error. The document type declaration is not strictly necessary for
this type of evaluation, but specifying the document type declaration
makes it easier to use a validator.
Example 1: HTML Validators
HTML pages include a document type declaration (sometimes referred to as !DOCTYPE statement). The developer can use offline or online validators (see Resources below) to check that id attributes values are only used once on a page. The W3C validador, for example, will report ID "X already defined" when it encounters the second use of an id value.
Resources are for information purposes only, no endorsement implied.
- Do not forget to add a doctype by the W3C Quality Assurance Initiative explains what doctypes are and why you should use them.
- Recommended DTDs to use in your Web document by the W3C Quality Assurance Initiative is a list of commonly used declarations.
- How do I validate my code or check for possible errors? describes the tools in the free editor HTML-Kit for checking HTML, CSS and XML.
For other resources, see G134: Validating Web pages.
- Check that all id attribute values are unique on the web page.
- Check 1 is true.