Role Attribute 1.0 (original) (raw)
An attribute to support the role classification of elements
W3C Recommendation 28 March 2013
This version:
http://www.w3.org/TR/2013/REC-role-attribute-20130328/
Latest published version:
http://www.w3.org/TR/role-attribute/
Latest editor's draft:
http://www.w3.org/WAI/PF/role-attribute/
Previous version:
http://www.w3.org/TR/2012/PR-role-attribute-20121213/
Editor:
Shane McCarron, Applied Testing and Technology, Inc., shane@aptest.com
Authors:
Richard Schwerdtfeger, IBM Corporation
Please refer to the errata for this document, which may include some normative corrections.
See also translations.
The English version of this specification is the only normative version. Non-normative translations may also be available.
Copyright © 2006-2013W3C® (MIT,ERCIM,Keio, Beihang), All Rights Reserved.W3C liability,trademark anddocument use rules apply.
Abstract
The Role Attribute defined in this specification allows the author to annotate markup languages with machine-extractable semantic information about the purpose of an element. Use cases include accessibility, device adaptation, server-side processing, and complex data description. This attribute can be integrated into any markup language. In particular, schema implementations are provided to facilitate with languages based upon XHTML Modularization [XHTML-MODULARIZATION11-2e].
The role attribute is necessary to support Accessible Rich Internet Applications (WAI-ARIA) [WAI-ARIA] to define roles in XML-based languages, when the languages do not define their own role attribute. Although this is the reason the Role Attribute is published by the Protocols and Formats Working Group, the attribute has more general use cases as well.
Status of This Document
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This is the Role Attribute W3C Recommendation by the Protocols & Formats Working Group of the Web Accessibility Initiative. This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.
As a finalized document, this version of the Role Attribute is not likely to undergo further changes. The Protocols and Formats Working Group expects that any further enhancements to the Role Attribute would take place in a future version of Accessible Rich Internet Applications (WAI-ARIA), instead of in a future version of this specification. The Working Group does not plan to make formal responses to comments on the Role Attribute Recommendation, but will consider input for errata or other future work. Start with the instructions for commenting page to submit comments (preferred), or send email to public-pfwg-comments@w3.org (comment archive). A history of changes to Role Attribute 1.0 is available.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy.W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes containsEssential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
Table of Contents
- 1. Introduction
- 2. Conformance
- 3. The Role Attribute
- 4. Using Role in conjunction with RDFa
- A. XHTML Role Attribute Module
- B. Acknowledgements
- C. References
1. Introduction
This section is non-normative.
This document defines an attribute designed be used to help improve the accessibility and semantic markup of documents. It has been developed in conjunction with the accessibility community and other groups to make it easier to describe the semantic meaning of document content.
An important (though not exclusive) use case for the Role Attribute is to support [WAI-ARIA]. The Role Attribute meets the requirements of Role Attribute in WAI-ARIA, Section 7.1, enabling [XML10] languages that incorporate this attribute to use WAI-ARIA roles. At time of this publication, no XML-based languages are known to use WAI-ARIA, but this attribute is important to enable planned future support (such as in SVG). By contrast, support for WAI-ARIA in [HTML5] includes an attribute named "role". The use of that attribute within [HTML5] is consistent with the definition of the role attribute in this specification, although conforming use may be limited to the use of 'TERM's within the value of the attribute.
2. Conformance
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL in this specification are to be interpreted as described in [RFC2119].
2.1 Document Conformance
The Role Attribute does not represent a stand-alone document type. It is intended to be integrated into other host languages such as SVG, HTML, or XHTML. A conforming Role Attribute document is a document that requires only the facilities described as mandatory in this specification and the facilities described as mandatory in its host language. Such a document must meet all the following criteria:
- The document MUST conform to the constraints expressed in its host language implementation.
- If the host language is an XML [XML10-4e] markup language and is in the XHTML Namespace
http://www.w3.org/1999/xhtml
), there are no additional requirements. If the host language is an XML markup language and is not in the XHTML namespace, and the host language does not incorporate this attribute in 'no namespace', then the document MUST contain an XML namespace declaration for the Role Attribute Module namespace [XML-NAMES11]. The namespace for Role Attribute Module is defined to behttp://www.w3.org/1999/xhtml
. An example start tag of a root element might look like:
Example 1
2.2 Host Language Conformance
When the Role Attribute is included in a host language, all of the facilities required in this specification MUST be included in the host language. In addition, the attribute defined in this specification MUST be included in the content model of the host language.
3. The Role Attribute
This specification defines the role
attribute. The role
attribute takes as its value one or more whitespace separated TERMorCURIEorAbsIRIs
, which is defined in [RDFA-CORE]. Each component of the value maps to an IRI that corresponds to a vocabulary term that SHOULD be defined using RDF.
Note
The datatype used for @role permits the use of a TERM, a CURIE (as defined in [RDFA-CORE]), or a full IRI. A TERM is an item from a vocabulary. The default vocabulary for use with @role is defined in [XHTML-VOCAB]. A host language MAY define a different default vocabulary.
Note
The specific vocabulary terms from the default vocabulary are not included in this document. They are defined in [XHTML-VOCAB] to ease maintenance. The terms are drawn from [WAI-ARIA] and from the original work on this document by the XHTML2 Working Group.
The attribute describes the role(s) the current element plays in the context of the document. This can be used, for example, by applications and assistive technologies to determine the purpose of an element. This could allow a user to make informed decisions on which actions may be taken on an element and activate the selected action in a device independent way. It could also be used as a mechanism for annotating portions of a document in a domain specific way (e.g., a legal term taxonomy). Although the role attribute may be used to add semantics to an element, authors SHOULD use elements with inherent semantics, such as p
, rather than layering semantics on semantically neutral elements, such as div role="paragraph"
.
The following is an example of a good, appropriate use of the role attribute:
Example 2
This is the main content of the page
Here is some content that is the primary purpose of this web page.
3.1 Extending the collection of roles
It is possible to define additional role values. Vocabulary authors MUST define such additional role values in their own vocabulary. The URI associated with that vocabulary SHOULD resolve to a resource that allows for the machine and human discovery of the definition of the roles in the vocabulary.
Note
A good example of such a resource is the default vocabulary document at [XHTML-VOCAB]. This document uses a format compatible with the requirements of [RDFA-CORE] section 9 for machine-discoverable RDFa Initial Contexts.
4. Using Role in conjunction with RDFa
If a Host Language contains the @role attribute, then an RDFa processor processing a document written in that Host Language according to the rules of that Host Language MAY generate additional triples for role attributes. If these additional triples are being generated, then they MUST be generated as follows:
- If @id is present, it is used to supply the subject by concatenating the document's 'base', a fragment separator '#', and the value of @id. Otherwise the subject is a unique newly created
bnode
. - The predicate is the term
role
in the vocabulary defined athttp://www.w3.org/1999/xhtml/vocab
. - Each value of @role is an object, forming an RDF triple with the subject and predicate defined above. An RDFa Processor MUST behave as if there is an in-scope vocabulary of
http://www.w3.org/1999/xhtml/vocab#
for the value(s) of the @role attribute.
Note
Remember that @role values are defined using the datatype TERMorCURIEorAbsIRIs
. An RDFa Processor will intepret these values using the rules for that that datatype as defined in [RDFA-CORE].
A. XHTML Role Attribute Module
A.1 DTD Implementation
The DTD implementation of XHTML Role Attribute Module conforms to the requirements defined in [XHTML-MODULARIZATION11-2e]. Consequently, it provides a Qualified Names declaration module.
A.1.1 Qualified Names Module
Note that this module defines the parameter entity%xhtml-role-attrs.qname;
. This entity is intended to be used in the attribute lists of elements in any host language that permits the use of the role attribute on elements in its own namespace. If a host language does not permit role in its namespace, then the host language driver should set a parameter entity %XHTML-ROLE.prefixed;
to INCLUDE
and a parameter entity %XHTML-ROLE.prefix;
to a value that is the prefix for the XHTML Role Attribute Module attribute.
<![%XHTML-ROLE.prefixed;[ ]]>
%xhtml-role-qname-extra.mod;
A.2 Schema Implementation
The schema implementation of XHTML Role Attribute Module conforms to the requirements defined in [XHTML-MODULARIZATION11-2e]. It is included here as an example implementation.
A.2.1 Attributes Module
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:xh11d="http://www.w3.org/1999/xhtml/datatypes/"
<xs:import namespace="http://www.w3.org/1999/xhtml/datatypes/"
schemaLocation="xhtml-datatypes-1.xsd" />
<xs:annotation>
<xs:documentation>
This is the XML Schema attribute module for XHTML Role
<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>I</mi><mi>d</mi><mo>:</mo><mi>O</mi><mi>v</mi><mi>e</mi><mi>r</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mi mathvariant="normal">.</mi><mi>h</mi><mi>t</mi><mi>m</mi><mi>l</mi><mo separator="true">,</mo><mi>v</mi><mn>1.82017</mn><mi mathvariant="normal">/</mi><mn>10</mn><mi mathvariant="normal">/</mi><mn>0210</mn><mo>:</mo><mn>47</mn><mo>:</mo><mn>16</mn><mi>d</mi><mi>e</mi><mi>n</mi><mi>i</mi><mi>s</mi><mi>E</mi><mi>x</mi><mi>p</mi></mrow><annotation encoding="application/x-tex">Id: Overview.html,v 1.8 2017/10/02 10:47:16 denis Exp </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.07847em;">I</span><span class="mord mathnormal">d</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">O</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord mathnormal" style="margin-right:0.02778em;">er</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord mathnormal">i</span><span class="mord mathnormal">e</span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mord">.</span><span class="mord mathnormal">h</span><span class="mord mathnormal">t</span><span class="mord mathnormal">m</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">1.82017/10/0210</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">47</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">16</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mord mathnormal">ni</span><span class="mord mathnormal">s</span><span class="mord mathnormal" style="margin-right:0.05764em;">E</span><span class="mord mathnormal">x</span><span class="mord mathnormal">p</span></span></span></span>
</xs:documentation>
<xs:documentation source="xhtml-copyright-1.xsd"/>
<xs:documentation source="http://www.w3.org/TR/role-attribute#A_role"/>
</xs:annotation>
<xs:attribute name="role" type="xh11d:TERMorURIorCURIEs"/>
B. Acknowledgements
The following people contributed to the development of this document.
B.1 Participants in the PFWG at the time of publication
- David Bolter (Mozilla)
- Sally Cain (Royal National Institute of Blind People (RNIB))
- Alex Qiang Chen (University of Manchester)
- Charles Chen (Google, Inc.)
- Michael Cooper (W3C/MIT)
- James Craig (Apple, Inc.)
- Steve Faulkner (Invited Expert, The Paciello Group)
- Geoff Freed (Invited Expert, NCAM)
- Kentarou Fukuda (IBM)
- Georgios Grigoriadis (SAP AG)
- Jon Gunderson (Invited Expert, UIUC)
- Markus Gylling (DAISY Consortium)
- Sean Hayes (Microsoft Corporation)
- Kenny Johar (Microsoft Corporation)
- Shilpi Kapoor (BarrierBreak Technologies)
- Matthew King (IBM Corporation)
- Diego La Monica (International Webmasters Association / HTML Writers Guild (IWA-HWG))
- Rajesh Lal (Nokia Corporation)
- Gez Lemon (International Webmasters Association / HTML Writers Guild (IWA-HWG))
- Anders Markussen (Opera Software)
- Shane McCarron (Invited Expert, ApTest)
- Charles McCathieNevile (Opera Software)
- Mary Jo Mueller (IBM Corporation)
- James Nurthen (Oracle Corporation)
- Joshue O Connor (Invited Expert, NCBI Centre for Inclusive Technology)
- Sarah Pulis (Media Access Australia)
- T.V. Raman (Google, Inc.)
- Janina Sajka (Invited Expert, The Linux Foundation)
- Joseph Scheuhammer (Invited Expert, Inclusive Design Research Centre, OCAD University)
- Stefan Schnabel (SAP AG)
- Richard Schwerdtfeger (IBM Corporation)
- Lisa Seeman (Invited Expert)
- Cynthia Shelly (Microsoft Corporation)
- Andi Snow-Weaver (IBM Corporation)
- Gregg Vanderheiden (Invited Expert, Trace Research and Development Center)
- Léonie Watson (Nomensa)
- Gottfried Zimmermann (Invited Expert, Access Technologies Group)
B.2 Other previously active PFWG participants and contributors
Jim Allan (TSB), Simon Bates, Chris Blouch (AOL), Judy Brewer (W3C/MIT), Ben Caldwell (Trace), Charles Chen (Google, Inc.), Christian Cohrs, Dimitar Denev (Frauenhofer Gesellschaft), Donald Evans (AOL), Kentarou Fukuda (IBM Corporation), Becky Gibson (IBM), Alfred S. Gilman, Andres Gonzalez (Adobe Systems Inc.), Georgios Grigoriadis (SAP AG), Jeff Grimes (Oracle), Barbara Hartel, John Hrvatin (Microsoft Corporation), Masahiko Kaneko (Microsoft Corporation), Earl Johnson (Sun), Jael Kurz, Diego La Monica (International Webmasters Association / HTML Writers Guild (IWA-HWG)), Aaron Leventhal (IBM Corporation), Alex Li (SAP), Thomas Logan (HiSoftware), William Loughborough, Linda Mao (Microsoft), Anders Markussen (Opera Software), Matthew May (Adobe Systems Inc.), Artur Ortega (Yahoo!, Inc.), Lisa Pappas (Society for Technical Communication (STC)), Dave Pawson (RNIB), Stephen Pemberton (CWI), David Poehlman, Simon Pieters (Opera Software), T.V. Raman (Google, Inc.), Gregory Rosmaita, Tony Ross (Microsoft Corporation), Martin Schaus (SAP AG), Marc Silbey (Microsoft Corporation), Henri Sivonen (Mozilla), Henny Swan (Opera Software), Vitaly Sourikov, Mike Squillace (IBM), Ryan Williams (Oracle), Tom Wlodkowski.
B.3 Enabling funders
This publication has been funded in part with Federal funds from the U.S. Department of Education, National Institute on Disability and Rehabilitation Research (NIDRR) under contract number ED-OSE-10-C-0067. The content of this publication does not necessarily reflect the views or policies of the U.S. Department of Education, nor does mention of trade names, commercial products, or organizations imply endorsement by the U.S. Government.
C. References
C.1 Normative references
[RDFA-CORE]
Shane McCarron et al. RDFa Core 1.1: Syntax and processing rules for embedding RDF through attributes. 7 June 2012. W3C Recommendation. URL: http://www.w3.org/TR/2012/REC-rdfa-core-20120607/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Internet RFC 2119. URL: http://www.ietf.org/rfc/rfc2119.txt
[XHTML-MODULARIZATION11-2e]
Shane McCarron. XHTML™ Modularization 1.1 Second Edition. 29 July 2010. W3C Recommendation. URL: http://www.w3.org/TR/2010/REC-xhtml-modularization-20100729
[XHTML-VOCAB]
XHTML 2 Working Group. XHTML Vocabulary. URL: http://www.w3.org/1999/xhtml/vocab
[XML10]
C. M. Sperberg-McQueen et al. Extensible Markup Language (XML) 1.0 (Fifth Edition). 26 November 2008. W3C Recommendation. URL: http://www.w3.org/TR/2008/REC-xml-20081126/
[XML10-4e]
C. M. Sperberg-McQueen et al. Extensible Markup Language (XML) 1.0 (Fourth Edition). 16 August 2006. W3C Recommendation. URL: http://www.w3.org/TR/2006/REC-xml-20060816/
C.2 Informative references
[HTML5]
Robin Berjon et al. HTML5. 17 December 2012. W3C Candidate Recommendation. URL: http://www.w3.org/TR/html5/
[WAI-ARIA]
James Craig; Michael Cooper et al. Accessible Rich Internet Applications (WAI-ARIA) 1.0. 24 February 2009. W3C Working Draft. URL: http://www.w3.org/TR/2009/WD-wai-aria-20090224
[XML-NAMES11]
Andrew Layman et al. Namespaces in XML 1.1 (Second Edition). 16 August 2006. W3C Recommendation. URL: http://www.w3.org/TR/2006/REC-xml-names11-20060816