The W3 ARIA recommendation specifies new HTML attributes (like "aria-describedby") to help screen readers identify relationships between elements. These new attributes tell screen readers about relationships that can't be derived from existing HTML semantics, and usually only obvious from the position of items on screen (e.g. a paragraph of help text next to a form field).

Most people who've tried adding ARIA attributes to HTML have noticed that documents don't validate unless the HTML 5 DOCTYPE is used: <!DOCTYPE html>.

Why is this - are the validators all broken? Unfortunately, the problem is worse than this.

What's the problem?

The validation rules used by and the other validators out there (including SortSite) use a machine-readable description of HTML called a Document Type Definition (DTD). Prior to HTML 5, each version of HTML and XHTML was specified by a DTD describing which element and attribute names are allowed in a document.

Here's the problem:

  • The W3 specifications of HTML 4.01 (1999),  XHTML 1.0 (2000 revised 2002) and XHTML 1.1 (2001 revised 2010) all pre-date ARIA (2011) so weren't aware of ARIA at the time of writing.
  • The W3 specifications all contain DTDs that are marked as normative (i.e. the DTDs are a prescriptive part of the specification, so cannot be changed and aren't open to interpretation). 
  • This means that ARIA can't be added to these DTDs without revising the underlying specifications 

In retrospect, including DTDs as part of the normative specifications of HTML and XHTML was probably a mistake by the W3 working groups, and one that's been avoided in HTML 5 which doesn't use DTDs. HTML 5 also has the advantage that it's still draft, which allowed ARIA to be added relatively easily.

Don't expect the W3 to add ARIA to DTDs for old versions of HTML any time soon. Even fixing obvious bugs in the DTDs takes a very long time, because it requires a specification revision. The usemap bug in the XHTML 1.1 DTD took 8 years to fix - prior to the 2010 revision of XHTML 1.1 you had to choose between working image maps or valid code.

Does HTML 5 fix this?

Going the HTML 5 route isn't a panacea: the validation rules for HTML 5 never quite match the current HTML 5 draft specification because the draft is constantly changing, as do the HTML 5 validation rules. The HTML 5 validator is quite up front about this, when you validate HTML you see this message:

"The validator checked your document with an experimental feature: HTML5 Conformance Checker. This feature has been made available for your convenience, but be aware that it may be unreliable, or not perfectly up to date with the latest development of some cutting-edge technologies."

This situation is likely to continue until HTML 5 reaches Candidate Recommendation status - probably sometime in 2012/2013. 

What else can I do?

The ARIA working group are aware of the problem, and have produced two unofficial DTDs that do allow ARIA to validate:

XHTML 1.1 with ARIA

HTML 4.01 with ARIA

These DTDs are both available in and SortSite 4.6, but as the ARIA recommendation notes, using the DOCTYPEs for either of these DTDs cause significant problems in browsers (such as character entities like &NBSP; not working correctly).

In SortSite the other option is to to selectively ignore validation errors for aria- prefixed attributes using Ignore Rule menu command. To do this right click on the Rule Options link next to an error for an aria feature, and choose Ignore Rule.

Catch 22?

If you want to use ARIA and be standards compliant you're in Catch 22 situation:

  • Use the HTML 5 doctype (but be aware that what validates today may not validate tomorrow because the HTML 5 validator isn't stable yet)
  • Use ARIA in HTML 4.01 or XHTML 1.x and live with the validation errors and the fact you're no longer compliant with the XHTML and HTML 4 specifications (plus you risk missing real validation errors  in a sea of ARIA validation errors)
  • Use a validation tool that lets you disable ARIA specific validation errors