W3 ARIA - why doesn't it validate?

Posted by Mark Rogers on Mar 4, 2012 | 


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 validator.w3.org 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:

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 validator.w3.org 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:



First posted Mar 2012