This Wiki page is edited by participants of the HTML Accessibility Task Force. It does not necessarily represent consensus and it may have incorrect information or information that is not supported by other Task Force participants, WAI, or W3C. It may also have some very useful information.
- 1 A Role Attribute for HTML5
- 1.1 Introduction
- 1.2 Proposal for a "role" attribute for HTML5
- 1.3 Comments on the Original role for HTML5 Proposal
- 1.4 Role Attribute Genericized Proposal
A Role Attribute for HTML5
Use cases for a
role attribute for HTML5, include:
- device adaptation,
- server-side processing, and
- complex data description.
Proposal for a "role" attribute for HTML5
Role Attribute Original Limited Proposal
Recently, the "curly brackets" hack of identifying a graphical image by its use or type by inserting a generic identifier / descriptor in curly braces as the @alt value for an IMG, has been added to the HTML5 working draft.
Not only is the "curly bracket" technique insufficient, it constitutes both an abuse of the alt attribute and does not satisfy the WCAG requirement that alt text contains a textual equivalent of the image.
Therefore, i would like PF to FORMALLY propose to the HTML WG that:
- the "curly brackets" verbiage concerning
altbe removed from the HTML5 draft;
- that a
typeattribute be added to the
IMGelement's collection of attributes, which would provide the sort of generic information that the current draft of HTML5 specifies should be contained in curly brackets as the value for
alt-- for example:
altremain what it was intended to be -- a REQUIRED terse textual equivalent for static images, in accordance with the usage guidance provided by WCAG, ATAG, and UAAG, and in line with the
altinherited from HTML 4.01. Furthermore, a conscientious author who desires to provide both human-parseable and machine-processable information about the
IMGneeds a means of communicating a textual equivalent to the user as well as a means of providing machine-parsable information.
typeis used to indicate the function of the image for machine processing, then the
IMGMUST contain either
aria-role="presentation"is used, then the use of null
altconstitutes valid use; if
aria-role="image"is used, however, empty
altvalues or the lack of an
altattribute for the
IMGare to be considered validation errors.
- that a
roleattribute be added to HTML5 as a global attribute, in the same manner that
titlewas introduced in HTML4.
- that a pre-defined list of roles for individual elements -- in specific, the OBJECT, EMBED, and media-specific elements introduced in HTML5 -- be specified in HTML5 to provide a common baseline / consistency for authors, implementors and developers of "mainstream" and assistive technologies;
Comments on the Original role for HTML5 Proposal
Rob Burns (HTML WG member)
Thanks for initiating this issue. It's high priority in my view.
role is exactly the appropriate place for this data. As more and more photographs are taken with digital cameras it is very easy to tag them as role='photo' from the internal metadata of the image format. The only exceptions that would require manual role metadata assignment would be scanned photographs or photographs that are photographs taken with a digital camera but taken of a physical print format of another role. For example, someone might take a photograph of a diagram, a bar chart, or geographic map. To me these are the types of role an image might serve as (whether from a photograph or generated wholly from software). So some suggestions:
chart might also be broken down into greater detail like:
A reference list of role keywords
XHTML role attribute module
Mac OS X AXRoles (accessibility api)
less relevant to HTML:
TV Raman (Google, etc.)
Only change I'd recommend in what you describe for @role:
Rather than making it specific to the
IMG tag, define a set of
role values for image-type things, e.g. logo, pencil-drawing, picture, photo, whatever (a small handful) -- and add this to the legal values that might appear as the right-hand-side of role. This is more generally useful -- e.g. when you have a
DIV that contains a bunch of "stuff" that is supposed to make up a logo. The attribute would still be usable on
IMG as you describe -- it would just be usable more generally.
Role Attribute Genericized Proposal
Synchronization With the XHTML Role Vocabulary
XHTML Metainformation Vocabulary
The XHTML Metainformation Module defined as part of XHTML+RDFa specifies the following vocabulary items for use in the
- alternate designates alternate versions for a resource.
- appendix refers to a resource serving as an appendix in a collection.
- bookmark refers to a bookmark - a link to a key entry point within an extended document.
- cite refers to a resource that defines a citation.
- chapter refers to a resource serving as a chapter in a collction.
- contents refers to a resource serving as a table of contents.
- copyright refers to a copyright statement for the resource.
- glossary refers to a resource providing a glossary of terms.
- help refers to a resource offering help.
- icon refers to a resource that represents an icon.
- index refers to a resource providing an index.
- last refers to the last resource in a collection of resources.
- license refers to a resource that defines the associated license.
- meta refers to a resource that provides metadata.
- next refers to the next resource (after the current one) in an ordered collection of resources.
- p3pv1 refers to a P3P Policy Reference File P3P.
- prev refers to a previous resource (before the current one) in an ordered collection of resources.
- section refers to a resource serving as a section in a collection.
- stylesheet refers to a resource serving as a stylesheet for a resource.
- subsection refers to a resource serving as a subsection in a collection.
- start refers to the first resource in a collection of resources.
- up refers to a resource "above" in a hierarchically structured set.
Items from the XHTML Role Module
The following values are defined for use in the role attribute as specified in the XHTML Role Attribute Module:
- banner contains the prime heading or internal title of a page.
- secondary indicates that the section supports but is separable from the main content of resource.
- contentinfo has meta information about the content on the page or the page as a whole.
- definition indicates the definition of a term or concept.
- main acts as the main content of the document.
- navigation indicates a collection of items suitable for navigating the document or related documents.
- note indicates the content is parenthetic or ancillary to the main content of the resource.
- search indicates that the section provides a search facility.
ARIA 1.0 Pre-Defined Roles
- A message with an alert or error information.
- A separate window with an alert or error information.
- A software unit executing a set of tasks for its users.
- Allows for user-triggered actions.
- A control that has three possible values, (true, false, mixed).
- A table cell containing header information for a column.
- Combobox is a presentation of a select, where users can type to locate a selected item.
- Descriptive content for a page element which references this element via describedby.
- A dialog is a small application window that sits above the application and is designed to interrupt the current processing of an application in order to prompt the user to enter information or require a response.
- A list of references to members of a single group.
- Content that contains related information, such as a book.
- A grid contains cells of tabular data arranged in rows and columns (e.g., a table).
- A gridcell is a table cell in a grid. Gridcells may be active, editable, and selectable. Cells may have relationships such as controls to address the application of functional relationships.
- A group is a section of user interface objects which would not be included in a page summary or table of contents by an assistive technology. See region for sections of user interface objects that should be included in a page summary or table of contents.
- A heading for a section of the page.
- An img is a container for a collection elements that form an image.
- Interactive reference to a resource (note, that in XHTML 2.0 any element can have an href attribute and thus be a link)
- Group of non-interactive list items. Lists contain children whose role is listitem.
- A list box is a widget that allows the user to select one or more items from a list. Items within the list are static and may contain images. List boxes contain children whose role is option.
- A single item in a list.
- A region where new information is added and old information may disappear such as chat logs, messaging, game log or an error log. In contrast to other regions, in this role there is a relationship between the arrival of new items in the log and the reading order. The log contains a meaningful sequence and new information is added only to the end of the log, not at arbitrary points.
- A marquee is used to scroll text across the page.
- Offers a list of choices to the user.
- A menubar is a container of menu items. Each menu item may activate a new sub-menu. Navigation behavior should be similar to the typical menu bar graphical user interface.
- A link in a menu. This is an option in a group of choices contained in a menu.
- Defines a menuitem which is checkable (tri-state).
- Indicates a menu item which is part of a group of menuitemradio roles.
- A selectable item in a list represented by a select.
- An element whose role is presentational does not need to be mapped to the accessibility API.
- Used by applications for tasks that take a long time to execute, to show the execution progress.
- A radio is an option in single-select list. Only one radio control in a radiogroup can be selected at the same time.
- A group of radio controls.
- Region is a large perceivable section on the web page.
- A row of table cells.
- A table cell containing header information for a row.
- A line or bar that separates and distinguishes sections of content.
- A user input where the user selects an input in a given range. This form of range expects an analog keyboard interface.
- A form of Range that expects a user selecting from discrete choices.
- This is a container for process advisory information to give feedback to the user.
- A header for a tabpanel.
- A list of tabs, which are references to tabpanels.
- Tabpanel is a container for the resources associated with a tab.
- Inputs that allow free-form text as their value.
- A numerical counter which indicates an amount of elapsed time from a start point, or the time remaining until an end point.
- A toolbar is a collection of commonly used functions represented in compact visual form.
- A popup that displays a description for an element when a user passes over or rests on that element. Supplement to the normal tooltip processing of the user agent.
- A form of a list having groups inside groups, where sub trees can be collapsed and expanded.
- A grid whose rows can be expanded and collapsed in the same manner as for a tree.
- An option item of a tree. This is an element within a tree that may be expanded or collapsed.
Possible non-text media relevant role keywords
- layout or spacer
- illustrative (indicates the image is merely an illustration of the surrounding text, adding no more meaning to the surrounding text)
- albumphoto (a photo presented along with a collection of photos as an album or slideshow, either presented entirely within the same document or a collection of related documents)
- visualization (mathematic visualization like fractals, topological, etc)
- chart (including graphs such as: bar chart, line graph, pie chart, organizational chart, bar chart)
- geomap (a map of geography as opposed to a site map or other diagram)
- text (styled text: the equivalent semantic markup should be presented OBJECT element contents, though obviously not when using the plaintext only alt attribute)
- mathexpr (similar to richtext since few UAs support math XML vocabularies)
- musicscore (similar to richtext since few UAs support music XML vocabularies)
- livecam (for stills generated from a live webcam)
- Other mime types
- interactive (for interactive multipmedia, e.g., an applet or flash based game)
- camera (like photo for video to distinguish camera originated video from digitally generated video)
- livecam (also for video stream as opposed to stills)
Each role keyword might correspond to different specific advice for alt text for a resource, allowing authors a simplified two-step process to providing text equivalents For example, some role keywords might require no alt text or text equivalent whatsoever. While on the other hand, something like role='portrait' might specify a list of the names of the individuals in the portrait from left to right (for ltr text): e.g., alt='Mona Lisa").
Relation to alt text replacement
The following table shows the relation of the alt text to the role keyword. Authors must include at least one of the following keywords on the element for each embedded resource. In some cases a null value for the alt text can be automatically inferred by UAs from the author designated role and conformance checkers can alert authors when the role and alt attributes are inconsistently specified. Conformance checkers can also provide focussed guidance to authors based on the role attribute keywords. The role attribute must always be specified, while the alt attribute might sometimes be null (note the various required, recommended and optional categories for alt text are only suggested as one possible approach the role attribute makes possible; these could all be required for strictness).
|keyword||description||alt text requirement|
|layout or spacer||single space (U+0020)|
|icon||non-null text signifying what the icon represents|
|logo||non-null text signifying what the logo represents|
|illustrative||indicates the image is merely an illustration of the surrounding text, adding no more meaning to the surrounding text||null|
|albumphoto||a photo presented along with a collection of photos as an album or slideshow, either presented entirely within the same document or a collection of related documents||description|
|portrait||names of persons portrayed|
|chart||including graphs such as bar chart, line graph, pie chart, organizational chart, bar chart||WCAG alt text replacement|
|diagram||WCAG alt text replacement|
|geomap||a map of geography as opposed to a site map or other diagram||WCAG alt text replacement|
|text||styled text||WCAG alt text replacement|
|mathexpr||similar to richtext since few UAs support math XML vocabularies||WCAG alt text replacment|
|musicscore||similar to richtext since few UAs support music XML vocabularies||WCAG alt text replacement|
|livecam||for stills generated from a live webcam||subject of livecam|
|musicaccomp||a musical accompaniment to a document||description|
|spokenequivalent||audio provided as a spoken equivalent for the document or a portion of the document||null|
|interactive||for interactive multipmedia, e.g., an applet or flash based game||WCAG alt text replacement|
|camera||like photo for video to distinguish camera originated video from digitally generated video||WCAG alt text replacement|
|livecam||also for video stream as opposed to stills||subject of livecam|