This proposal defines proper usage of ARIA markup for authors and ARIA markup processing for user agents for both (X)HTML and SVG.
role
attributes
This spec assumes that HTML elements are in the
http://www.w3.org/1999/xhtml
namespace, as required by HTML5.
What authors are allowed to do should probably be constrained, and UAs should perhaps ignore some roles or states in certain cases.
All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC2119. For readability, these words do not appear in all uppercase letters in this specification. [RFC2119]
Implementations must support some version of DOM Core, because this specification is defined in terms of the DOM. [DOM3CORE]
role
attributesAuthors may specify a role
attribute in no namespace on any
element in the http://www.w3.org/1999/xhtml
or
http://www.w3.org/2000/svg
namespace.
The value of these attributes must be an ordered set of space-separated tokens where each token must be a valid role token. For accessibility-related roles, the first supported role will be used; subsequent roles act as fallback roles. [HTML5]
A valid role token is one of the following:
A role as defined in WAI-ARIA Roles or XHTML Role Attribute Module. [ROLES] [MODULE]
A CURIE whose prefix is not omitted. [CURIE]
The following snippet shows how role
can be used in HTML:
<div role="checkbox" tabindex="0"></div>
The folowing snippet shows how it can be used in XHTML and SVG:
<html xmlns="http://www.w3.org/1999/xhtml"> ... <div role="checkbox" tabindex="0"/> <svg xmlns="http://www.w3.org/2000/svg"> <circle role="checkbox" focusable="true"/> ...
UAs must process the value of a role
attribute in no
namespace that is part of an element in the
http://www.w3.org/1999/xhtml
or
http://www.w3.org/2000/svg
namespace as described below.
The following algorithm will return the role identifier:
Let tokens be the result of splitting the string on spaces. [HTML5]
For each token in tokens:
If token is a role as defined in WAI-ARIA Roles, then return token and abort these steps. [ROLES]
If token is a supported custom role that is supposed to map to an accessibility API, then return token and abort these steps.
It is expected that AT vendors would introduce such custom roles.
Return the empty string.
UAs must expose the entire value of the attribute as a string to the AT
using accessibility API specific methods, unless the role identifier is presentation
and the element on which the attribute is specified is not focusable. UAs
should also map the role identifier to an
accessibility API specific role, if there is one. [MAPPING]
Find out what that actually means and define it.
When the role identifier is the empty string, it won't map to anything.
Authors may specify a state or property propertyname (as
defined in WAI-ARIA States and Properties) by specifying an attribute
aria-propertyname
in no namespace on an element in
the http://www.w3.org/1999/xhtml
or
http://www.w3.org/2000/svg
namespace. [STATES]
The value of these attributes must be one of the allowed values of the state or property propertyname (as defined in WAI-ARIA States and Properties). [STATES]
The following snippet shows how states and properties can be declared in HTML:
<div aria-hidden="true">...</div>
The following snippet shows how they can be declared in XHTML and SVG:
<html xmlns="http://www.w3.org/1999/xhtml"> ... <div aria-hidden="true">...</div> <svg xmlns="http://www.w3.org/2000/svg"> <g aria-hidden="true">...</g>
UAs must process an aria-propertyname
attribute
in no namespace that is part of an element in the
http://www.w3.org/1999/xhtml
or
http://www.w3.org/2000/svg
namespace as described below.
Map propertyname to an accessibility API specific attribute, if any, and pass along the value. [MAPPING]
[MODULE] http://www.w3.org/TR/2007/WD-xhtml-role-20071004/ [CURIE] http://www.w3.org/TR/2007/WD-xhtml-role-20071004/#sec_3.1.1. (for now) [ROLES] http://www.w3.org/WAI/PF/Group/GUI/ (Member-only) or http://www.w3.org/TR/2007/WD-aria-role-20070601/ [STATES] http://www.w3.org/WAI/PF/Group/adaptable/ (Member-only) or http://www.w3.org/TR/2007/WD-aria-state-20070601/ [MAPPING] http://developer.mozilla.org/en/docs/aria-to_API_mapping [XMLNS] http://www.w3.org/TR/2006/REC-xml-names-20060816/ [HTML5] http://www.whatwg.org/specs/web-apps/current-work/multipage/ [DOM3Core] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ [RFC2119] http://www.ietf.org/rfc/rfc2119.txt
Thanks to Al Gilman, Anne van Kesteren, Dave Raggett, Doug Schepers, Henri Sivonen, Ian Hickson, Maciej Stachowiak, Mark Birbeck, and Richard Schwerdtfeger for their useful and substantial comments.