HTML and CSS Reference
In-Depth Information
Understanding WAI-ARIA
The W3C Web Accessibility Initiative's Accessible Rich Internet
Applications suite (WAI-ARIA) is an independent spec that “plugs
the holes” in HTML 4 (or any other markup language) to help
web applications and web pages to be made more accessible.
Imagine that you have scripted a slider control. In HTML 4 there
is no native slider, so if you just have some HTML elements (an
<input> , some images) with some JavaScript attached to act and
look like a slider. There is no way to tell the operating system
that the role of this widget is a slider and what its current state
and value are, and if the operating system doesn't know that
vital information, assistive technology such as screen readers
can't convey it to the user either.
ARIA aims to bridge this situation by introducing a whole series
of new attributes that browsers and assistive technologies can
hook into.
So, using horrible old-school HTML you could—in theory—add
<font size=”+5” color=”red”>I should be a heading</font>
to make
<font size=”+5” color=”red” role=”heading” aria-level=”2”>
¬ I should be a heading</font>
This tells the user agent that this text is a heading, level 2. But of
course, this would be nonsense, as HTML already has a perfectly
valid and semantic way of defining this sort of structure with
<h2>I AM a heading</h2>
A developer might forget to bolt on the necessary ARIA attri-
butes, whereas using the correct <h2> element has built-in
“heading-ness” and built-in level so it's a lot more robust. ARIA
is not a panacea or “get out of jail free” card for developers to
start abusing markup and make everything out of <div> s and
<span> s. Whenever possible, use the correct markup and only
use ARIA for situations where the correct semantics can't be
otherwise expressed (a slider in HTML 4 example, for instance).
The ARIA spec says “It is expected that, over time, host lan-
guages will evolve to provide semantics for objects that pre-
viously could only be declared with WAI-ARIA. When native
semantics for a given feature become available, it is appropriate
NOTE If you start using
these new ARIA attributes,
you may notice that your
HTML 4 pages won't validate
anymore. As long as the rest
of your markup is OK, that
doesn't matter—accessibility
trumps validity.
Search WWH ::

Custom Search