W3C

WAI-ARIA Best Practices

Editor's Draft 28 August 2008

This version:
http://www.w3.org/WAI/PF/aria-practices/
Latest public version:
http://www.w3.org/TR/wai-aria-practices/
Editors:
Lisa Pappas, SAS
Michael Cooper, W3C
Richard Schwerdtfeger, IBM

Abstract

This document specifies Best Practices for delivering accessible rich internet applications using WAI-ARIA [ARIA]. The principle objective is to produce a usable, accessible experience over the Web. It provides recommended approaches to create accessible Web content using WAI-ARIA roles, states, and properties to make widgets, navigation, and behaviors accessible. The document also describes considerations that might not be evident to most implementers from the WAI-ARIA specification alone. This document is directed primarily to Web application developers, but the guidance is also useful to user agent and assistive technology developers. This document is part of the WAI-ARIA suite described in the ARIA Overview.

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 an internal Editor's Draft of the Protocols and Formats Working Group. It is not stable and may change at any time. Implementors should not use this for anything other than experimental implementations. This document is available to W3C Members and should not be distributed to anyone who does not have W3C Member access.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. The group does not expect this document to become a W3C Recommendation. 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 contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

The disclosure obligations of the Participants of this group are described in the charter.

Table of Contents

  1. 1. Introduction
  2. 2. General Steps for Building an Accessible Widget with ARIA
  3. 3. Keyboard and Structural Navigation
    1. 3.1. Providing Keyboard Navigation for Widgets
      1. 3.1.1. ARIA Keyboard Bindings and Behaviors
      2. 3.1.2. Keyboard Navigation between Widgets
      3. 3.1.3. Keyboard Navigation within Widgets
      4. 3.1.4. Example Keyboard Operation: Radio Group/Radio
      5. 3.1.5. Other Widget Best Practices
      6. 3.1.6. Validation Issues
    2. 3.2. Providing Keyboard Focus
      1. 3.2.1. Tabindex
      2. 3.2.2. Using activedescendant vs. tabindex to manage focus for widget children
      3. 3.2.3. Author-Defined Keyboard Short-Cuts or Mnemonics
    3. 3.3. Supporting Tooltips with the Keyboard
    4. 3.4. Providing Navigable Structure within Web Pages
      1. 3.4.1. Steps for defining a logical navigational structure
      2. 3.4.2. Structural roles used to facilitate assistive technology navigation
      3. 3.4.3. Implicit Nesting and Headings
      4. 3.4.4. Grouping, Regions, and Directories
      5. 3.4.5. Remaining structural roles
      6. 3.4.6. Miscellaneous XHTML Section Roles
  4. 4. Relationships
    1. 4.1. Labeling and Describing
      1. 4.1.1. Labelled By
      2. 4.1.2. Described By
    2. 4.2. Owning and Controlling
      1. 4.2.1. The owns relationship.
      2. 4.2.2.  Using owns with reuse.
      3. 4.2.3. The controls relationship.
    3. 4.3. Changing the Reading Flow
  5. 5. Document Management
    1. 5.1. Managing Content and Presentational Changes
    2. 5.2. Implementing Live Regions
      1. 5.2.1. Live Region Properties and how to use them
    3. 5.3. Choosing between special case alert, alertdialog, status, and log live regions
  6. 6. Form Properties
  7. 7. Drag-and-Drop Support
  8. 8. States and properties modified by an external assistive technology
  9. 9. Implementation Guidance
    1. 9.1. Common Widget design patterns
    2. 9.2. Common structural widget design patterns
  10. 10. Reusable Component Libraries
  11. 11. Testing
    1. 11.1. Test case details
    2. 11.2. Test Result Matrix
  12. 12. Appendices
    1. 12.1. User Agent Implementation Considerations
    2. 12.2. ToDo List
    3. 12.3. References
    4. 12.4. Acknowledgments
      1. 12.4.1. Participants in the PFWG at the time of publication
      2. 12.4.2. Other previously active PFWG participants and other contributors to the Accessible Rich Internet Applications specification
      3. 12.4.3. Enabling funders

1. Introduction

This section is informative.

The WAI-ARIA Best Practices guide is intended to provide readers with an understanding of how to use WAI-ARIA to create an accessible Rich Internet Application. As explained in the WAI-ARIA Primer, accessibility deficiencies in today's markup render Rich Internet Applications (RIAs) unusable by people who use assistive technologies (AT) or who rely on keyboard navigation. The W3C Web Accessibility Initiative's (WAI) Protocols and Formats working group (PFWG) plans to address these deficiencies through several W3C standards efforts, with a focus on the ARIA specifications.

For an introduction to WAI-ARIA, see the Accessible Rich Internet Applications Suite (WAI-ARIA) Overview. The WAI-ARIA Best Practices is part of a set of resources that support the WAI-ARIA specification. The Best Practices describe recommended usage patterns for Web content developers, and the WAI-ARIA Primer [ARIA-PRIMER] provides a basic introduction to the concepts behind and reason for ARIA. The WAI-ARIA Suite fills gaps identified by the Roadmap for Accessible Rich Internet Applications (WAI-ARIA Roadmap) [ARIA-ROADMAP]. These documents serve as important places of clarification where topics appear to be unclear.

With the conceptual basis provided in the WAI-ARIA Primer, you should have a good understanding of how ARIA provides for interoperability with assistive technologies and support for a more usable, accessible experience. This guide begins by providing some general steps for building an accessible widget using ARIA, script, and CSS. It then extends your knowledge of ARIA with detailed guidance on how to make RIAs keyboard accessible. Next, the scope widens to include the full application, addressing necessary layout and structural semantics within the web page. These semantics are critical to enable assistive technologies to provide a usable experience when processing RIAs with rich documents on the same page. It includes guidance on dynamic document management; use of ARIA Form properties; ARIA Drag and Drop; and then the creation of ARIA-enabled alerts and dialogs. The appendix provides substantial reference information including code samples for developers of user agents, assistive technologies, and web pages.

2. General Steps for Building an Accessible Widget with ARIA

At this point you should have a basic understanding of how ARIA is used to support interoperability with assistive technologies. If you are not reusing an existing ARIA-enabled widget library and wish to create your own the following steps will guide you through the thought process for creating an accessible widget using ARIA.

  1. Pick the widget type (role) from the ARIA taxonomy

    ARIA provides a role taxonomy ([ARIA], Section 3.4) constituting the most common UI component types. Choose the role type from the provided table. If your desire was to create a toolbar set the role to toolbar:

    <div role="toolbar">
  2. From the role, get the list of supported states and properties

    Once you have chosen the role of your widget, consult the WAI-ARIA specification [ARIA] for an in-depth definition for the role in to find the supported states, properties, and other attributes. For example, the toolbar role definition includes:

    parent role
    In the taxonomy the widget you selected inherits states and properties from this role. In the case of a toolbar you will see that a toolbar is a subclass of a group. This makes sense given that a toolbar is a collection of commonly used functions.
    related concept
    This is really more informative to state what other concepts are similar to this role. These may exist in different host languages outside ARIA.
    supported states and properties
    These are unique states and properties that this widget supports and that were not inherited from its ancestors in the taxonomy. In the case of a toolbar there are no such states or properties. However, in the case of a listbox, you may choose to set the property of multiselectable to true if you were to have more than one tool in the listitem selected at a time. This indicates to the assistive technology that the listbox manages a collection of selectable options.
    inherited states and properties
    These are all the states and properties which are inherited from the roles's ancestors and which you may use.
    global states and properties
    These are states and properties which apply to all host language components regardless of whether a role is set or not. You may use these as well.

    Once you have chosen the states and properties that apply to your widget you must set those properties you will use to their initial values. Note: you do not need to use all the states and properties available for your role. In our case we shall use:

    <div role="toolbar" tabindex="0" aria-activedescendant="button1">

    Here, we have decided that the toolbar will received focus in document order (tabindex="0") and that we will manage which child receives focus when the toolbar receives focus. At this time, we have chosen the first button to be active when the toolbar receives focus. In user agents that support activedescendant, this may cause the user agent to send a focus change event to the first button.

    Important: When embedding WAI-ARIA markeup in (X) HTML, it is important that all aria states and properties be preceded by an aria- with the exception of the role attribute and tabindex. Otherwise, the user agent will not map the WAI-ARIA information resulting it not being recognized by assistive technologies.

    When embedding WAI-ARIA into other host languges, tabindex does not carry over. The WAI-ARIA tabindex extensions are specific to (X)HTML to repair deficiences in keyboard support.

  3. Establish the widget structure in the markup (parent/child)

    Assistive technologies are very dependent on the structure of widgets as well as general document structure. Structure provides context to the user. A toolbar is a collection of common functions made available to the user. Therefore, all functions you would like in the toolbar must be contained within it. This can be determined by using the Document Object Model [DOM] tree structure created by the browser when parsing the host language. By using the parent child relationship of the DOM, an assistive technology can determine all the related toolbar widgets associated with the toolbar. The toolbar widgets would be DOM children of the "toolbar" container. For our purposes we will define three image buttons for cut, copy, and paste.

    <div role="toolbar" tabindex="0" aria-activedescendant="button1">
      <img src="buttoncut"><img src="buttoncopy"><img src="buttonpaste">
    </div>  
  4. Repeat steps 1-3 for the children of the parent

    We now need to assign the roles and states for each of the children. However, we shall save the detailed navigation for step 5.

    <div role="toolbar" tabindex="0" aria-activedescendant="button1">
      <img src="buttoncut.png" role="button" id="button1">
      <img src="buttoncopy.png" role="button" id="button2">
      <img src="buttonpaste.png" role="button" id="button3">
    </div>
    

    The process of setting roles and states may be a recursive procedure if the children themselves have children, such as in the case of an expandable/collapsible tree widget.

  5. Establish keyboard navigation of the widget and plan for how it will be navigated to within the document

    It is very important that that your widget be keyboard accessible. In fact, there must also be a keyboard equivalent for every mouse operation. Where possible you should refer to the WAI-ARIA examples in this guide for tips on how to implement keyboard navigation for your widget. If you find that an example is not provided, you should follow standard keyboard bindings for UI components such as those used for the Java Foundation Classes for Windows 95/NT.

    For our toolbar, we have chosen to have the toolbar manage the focus for its children and through the use of the activedescendant property. We have also chose to have the toolbar receive focus based on the tab order by using tabindex. In order to use activedescendant, each descendant must have an assigned ID.

     <head>
     <script>
        ... 
        function optionKeyEvent(event)
          {
          var tb = event.target;
          var buttonid; 
      
          DOM_VK_ENTER = 13;
          // Partial sample code for processing arrow keys
    
          if (event.type == "keydown") {
             if (event.altKey) {
               return true;  // Browser should use this, the menu view doesn't need alt-modified keys
             }
             // XXX Implement circular keyboard navigation within the toolbar buttons
      
             if (event.keyCode == DOM_VK_ENTER) {
               ExecuteButtonAction(getCurrentButtonID(); // This is an author defined function
             }
             else if (event.keyCode == event.DOM_VK_RIGHT) {
               // Change the active toolbar button to the one to the right (circular) by 
               var buttonid = getNextButtonID();   // This is an author defined function
               tb.setAttribute("aria-activedescendant", buttonid); 
             }
             else if (event.keyCode == event.DOM_VK_LEFT) {
                // Change the active toolbar button to the one to the left (circular) by 
                var buttonid = getPrevButtonID();  // This is an author defined function
                tb.setAttribute("aria-activedescendant", buttonid); 
             } 
             else {
                return return true;
             }
             return false;
          }
          else if (event.type == "keypress") {
            ...
          }
        }  
    </script>
    
    <div role="toolbar" tabindex="0" aria-activedescendant="button1" id="tb1" 
         onkeydown="return optionKeyEvent(event);"
         onkeypress="return optionKeyEvent(event);">
       <img src="buttoncut.png" role="button" id="button1">      
       <img src="buttoncopy.png" role="button" id="button2">     
       <img src="buttonpaste.png" role="button" id="button3">     
    </div>

    The details of implementing keyboard navigation are described in Keyboard and Structural Navigation section of this document.

    Note: You must also show the visual focus for each element that has focus.

  6. Apply and and manage needed ARIA states in response to user input events

    Similar to the processing of activedescendant in Step 5, as author you must set any additional ARIA states and properties on document elements.

  7. Synchronize the visual UI with accessibility states and properties for supporting user agents

    You should consider tieing user interface changes directly to changes in WAI-ARIA states and properties, such as through the use of CSS attribute selectors. For example, the setting of the selected state may change the background of a selected treeitem in a tree. This may also be done with JavaScript.

    .treeitem[role="treeitem"][aria-selected="true"] {color: white; background-color: #222222;}
    
    .treeitem[role="treeitem"][aria-selected="false"] {color: white; background-color: beige;}        

    Authors should be aware that CSS attribute selectors are not supported in some browsers. For example, although it is supported in Firefox 2, it is not in Internet Explorer until version 7. In Internet Explorer 6 or earlier you should set the WAI-ARIA state or property and then apply the updated style information using script. Internet Explorer 7 supports CSS attribute selectors but then you need to refresh the style using element.className +="".The following example shows how to refresh the styling for a change the selected class attribute in a WAI-ARIA menu item in Internet Explorer 7.

    function setSelectedOption(menuItem)
         {
            if (menuItem.getAttribute("role") != "menuitem") {
               alert("Not a menu item");
               return;
            }
            var menu = getMenu(menuItem);
            var oldMenuItem = getSelectedOption(menu);
            
            // Set class so that we show selection appearance
            oldMenuItem.removeAttribute("class");
            menuItem.setAttribute("class", "selected");
            menu.setAttribute("aria-activedescendant", menuItem.id);
            menuItem.className += "";
          }
            
  8. Showing and Hiding Sections in a Widget

    The proper synchronization showing and hiding sections in a widget with the ARIA display state is also critical. Some platform accessibility APIs provide events for applications to notify the assistive technology when pop-ups such as menus, alerts, and dialogs come into view or go away. Rich Internet Applications can assist browsers which support these conventions by:

    1. Creating an entire section and then insert it into the Document Object Model [DOM], as a subtree of the parent element activated to show the pop-up, and then removing the section from the inserted area when the pop-up goes away.

      OR

    2. Using the following style sheet properties to show and hide document sections being used to represent the pop-up items, menus or dialogs:

      • display:block
      • display:none
      • visibility:visible
      • visibility:hidden

      By monitoring these behaviors a user agent may use this information to notify assistive technology that the pop-up has occurred by generating the appropriate accessibility API event.

    Some assistive technologies may use the DOM directly to determine these when pop-up occurs. In this case, the first mechanism of writing a section to the DOM would work using the DOM events as demonstrated here.

    // create new table row with table cell and div
    var newTr = document.createElement('TR');
    var newTd = document.createElement('TD');
    var newDiv = document.createElement('DIV');
    newTr.appendChild(newTd);
    newTd.appendChild(newDiv);

    //insert this new table row before theNode selected
    var container = theNode.parentNode;
    container.insertBefore(newTr, theNode);

    //remove theNode selected
    container.removeChild(theNode);"

    However, if you are using CSS to show and hide sections of the DOM (2) it is essential that you set the corresponding ARIA hidden property to indicate that the section is visible or hidden and synchronize it with your CSS styling as shown here:

    [aria-hidden=true] {visibility: hidden;}
    
    ...
    
    <div role="button" aria-haspopup="true" aria-owns="mypopupmenu">
    <div role="menu" aria-hidden="true" id="mypopupmenu">...</div>
  9. Support basic accessibility, such as alternative text on images

    When an image is used to represent information within a component, such as our image buttons, you need to set the alternative text on those images. This is then mapped by the user agent to the accessible name in the platform accessibility API. Using our example:

    <div role="toolbar" tabindex="0" aria-activedescendant="button1" id="tb1" 
         onkeydown="return optionKeyEvent(event);"      
         onkeypress="return optionKeyEvent(event);">    
       <img src="buttoncut" role="button" id="button1" alt="cut">
       <img src="buttoncopy" role="button" id="button2" alt="copy">
       <img src="buttonpaste" role="button" id="button3" alt="paste">      
    </div>
  10. Establish ARIA relationships between this widget and others

    Once you have made the basic widget accessible you may then need to establish its relationship to other widgets. Examples of this are labelledby, controls, describedby and flowto. The details of using these relationships are described in the Relationships section of this document.

    Other relationships which should be considered are more declarative and provide context to the widget within a set. For these, level, posinset, and setsize are provided. If you structure your Document Object Model appopriately so that the user agent can determine this information from it directly, using the DOM hierarchy you do not need to set these properties. There are however, situations in RIAs where all the elements in say are tree are not in the DOM at one time, such as when you can only render the ten of fifty items in a subtree. In this case the user agent cannot determine the number of tree items (setsize) for the position in the set (posinset), and potentially the tree depth (level) from the DOM. In these situations you will need to provide these WAI-ARIA properties.

  11. Review widget to ensure that you have not hard coded sizes

    The ability for applications to respond to system font settings is a requirement. Most user agents are designed to meet this requirement. This also means your web application running within your browser is impacted when the user agent changes the font sizes to meet the need. If you have hard coded your font size in pixels an increase in system fonts will not be reflected in your web application. You must also not hard code the size of your widgets in pixels either. If the fonts are scaleable, but the widget they are encapsulated in is not, then the text could flow outside your widget.

    Follow these rules to allow your application to respond to system font settings:

    • Establish a base set of font sizes and widget sizes based on em height
    • Ensure that all fonts used are a function of this base em height
    • Make sure all widgets are a function of the base em height

    An em is a is the font unit of measure between the top and bottom of an upper case letter M. This is independent of the scale which the font is reproduced. Often, the user agents font adjustment to system settings, are such that they are defined using the font's internal metrical units (font units), which are specified as units of the total body or em height of the font, hence em units. Em can be used as a proportional unit of length in CSS to scale properties in relation to the default font size settings in a users' browser.

    Important: Most browsers today have a zoom feature which allow the user to magnify the entire web page. Most legislation today requires that your application respond to system font and color settings and therefore you will want to consider the fact the system settings could adversely effect your web page should you decide to hard code pixel sizes.

  12. Test with User agent, Assistive Technology, and People with disabilities

    To ensure you have set your WAI-ARIA semantics correctly, test your application with your user agent, an assistive technology, and a person with disability. Example assistive technologies are screen readers and screen magnifiers. Ensure that your user agent is designed to support WAI-ARIA and their your assistive technology is designed to support ARIA in the selected user agent.

    Finding people with disabilities to do testing may be difficult but many companies employ people with disabilites, including your customers, and you should reach out to them to ask for help. Other places to look are advocacy groups like the National Federation of the Blind or your local schools for the blind, reading and learning centers, and so on. The people you reach out to may someday need to use what you produce.

3. Keyboard and Structural Navigation

Provide an effective navigation experience to the user is critical for usability. This section starts with guidance on how to provide effective keyboard navigation for widgets in a Rich Internet Application environment. This includes a discussion on how to manage keyboard focus and the specifics on providing keyboard navigation for tooltips. This is is followed by a broader discussion on how to convey structural semantics for the entire web page. These semantics help an assistive technology provide additional navigation, increase user productivity, and render the page in an alernative formats. This rendering may be in different forms, including but not limited to speech, page restructuring, and alternative input solutions.

3.1. Providing Keyboard Navigation for Widgets

3.1.1. ARIA Keyboard Bindings and Behaviors

Essential to accessible Web 2.0 widgets is keyboard support to provide full operation and functionality of a widget through keyboard-only events. Unlike traditional HTML form controls, Web 2.0 widgets, typically, have no inherent keyboard support. The developer must enable keyboard support for the widgets they create or use widget libraries with keyboard support. The best practices model for keyboard support for Web 2.0 widgets are graphical user interface (GUI) operating systems like Microsoft Windows®, Apple OSX®; and UNIX Desktops like GNOME and GTK. Two basic accessibility requirements for keyboard focus include:

  • Support users who cannot use pointing devices due to physical or visual impairment to access the full functionality of the Web application.
  • All major software and web accessibility guidelines for people with disabilities require keyboard-only operation of the interface for accessibility.
  • Communicate accessibility information to assistive technologies on the type of widget and its associated state and properties.

3.1.2. Keyboard Navigation between Widgets

The tabindex attribute enables focus to be moved via keyboard to HTML elements. For standard HTML 4.01, tabindex was limited to form and anchor elements. For WAI-ARIA, the tabindex attribute is now applicable to all renderable HTML elements with addtional funcionality designed to help the author produce keyboard accessible Web 2.0 widgets.

  • Tab and Shift+Tab key move focus among widgets and standard HTML controls.
  • Widgets with tabindex=0 will be added to the tab sequence based on document order
  • Widgets with tabindex>0 will be added to the tab sequence based on the TABINDEX value
  • Widgets with tabindex<0 will not be added to the tab sequence but are enabled to receive keyboard focus.

Once a widget has keyboard focus, arrow keys, Spacebar, Enter key, or other keyboard commands can be used to navigate the options of the widget, change its state, or trigger an application function associated with the widget.

3.1.3. Keyboard Navigation within Widgets

Each element that receives keyboard focus needs to have a tabindex attribute set to its current active desendant element and itself if an active desdendant does not exist. The element with keyboard focus is essential because it communicates information about the widget to assistive technologies like screen readers and magnifiers through operating specific accessibility APIs like Microsoft Active Accessibility (MSAA), the Apple Universal Accessibility API, and the ATK Accessibility Toolkit. The TAB key moves keyboard focus to the widget, and other keys operate the features of the widget, typically cursor keys, Enter key and Spacebar. The actual keys are up to the developer, but best practices recommend using the same key bindings that are used to control similar widgets in common GUI operating systems like Microsoft Windows®, Apple OSX® and UNIX Desktops like GNOME and GTK.

JavaScript can use either the focus() method to move focus to the appropriate element in the widget, or it can use an ARIA property called "activedescendant" on the actual widget container to indicate which element in the widget must have focus. The following procedure should be followed when focus is completely dependent on the use of tabindex to provice focus in a widget:

  • Set tabindex="0" to the current active descendant in the widget while setting tabindex="-1" on all the other child elements of the widget
  • As the user navigates (e.g. arrows) away from an item, the old item gets a tabindex="-1" and the new item gets tabindex="0".
  • Use the javascript method to set focus, using its JavaScript focus() method, on the item whose tabindex="-1"

This procedure creates a roving tabindex. If you tab away and tab back to the widget the same last active descendant becomes active again. This relieves the author from having to compute and set the focus to the last activedescendant.

Conversely, if you use the WAI-ARI activedescendant property things get a lot easier:

  • Set tabindex="0" on the element which represents a widget and set its activedescendant property to the id of the child you wish to be active
  • As the user navigates (e.g. arrows) away from an item in the widget refresh the activedescendant property on the containing widget to the id of the new active descendant child.

The browser will then be responsible for managing focus changes for you.

In both scenarious the author must indicate through styling and/or markup which element in the widget has focus or is "active."

3.1.4. Example Keyboard Operation: Radio Group/Radio

See working Radio button examples from the University of Illinois.

Key Bindings for Radio Group Behavior - Example
Key Description of Radio Group Behavior
Tab Key If no radio buttons is checked, focus moves to the first radio button in the group, but the radio button remains unchecked. If one radio buttons is checked, focus moves to the checked radio button. If SHIFT+TAB is pressed, focus moves to the last radio button in the group, but the radio button is not checked
Space Bar Checks the radio button with keyboard focus (this is a special case when using tab and no radio buttons have been marked as checked)
Down Arrow Move the checked radio button to next radio button. If no button is checked, check the first radio button. If the last radio button is checked, check the first radio button
Up Arrow Move the checked radio button to previous radio button. If no button is checked, check the last radio button. If the first radio button is checked, check the last radio button

In this Radio Group example, the tabindex of the radiogroup element initially has tabindex="0" (assuming none of the radio buttons is checked), the radio elements have tabindex="-1". As soon as one of the radio buttons is checked, the radio group element changes its value of tabindex="-1", the radio element that is checked changes its value to tabindex="0", and all other radio buttons have a tabindex ="-1".

3.1.5. Other Widget Best Practices

For specific keyboard navigation, see the Common Widget Design Patterns section.

3.1.6. Validation Issues

WAI-ARIA markup is currently not included in (X)HTML. The W3C WAI PF working group will be creating DTDs for XHTML 1.0 and HTML 4.01 for those wishing to validate their markup with WAI-ARIA embedded into these host languages.

3.2. Providing Keyboard Focus

One way to provide keyboard support in (X)HTML is with form and list elements that accept keyboard focus by default. With the Tab key, the user can navigate to these types of elements. However, when building sophisticated widgets it's necessary to be able to control keyboard navigation exactly and authors may require or prefer to use host language elements that do not have built-in keyboard navigation features. For example, the author may wish to provide keyboard navigation without impacting the tab order. Navigating within large composite widgets such as tree views, menubars, and spreadsheets can be very tedious and is inconsistent with what users are familiar with in their desktop counterparts. The solution is to provide full keyboard support using the arrow keys to provide more intuitive navigation to provide navigation within the widget, while allowing Tab and Shift+tab to move out of the widget to the next place in the tab order.

A tenet of keyboard accessibility is reliable, persistent indication of focus. The author is responsible, in the scripts, for maintaining visual and programmatic focus and observing accessible behavior rules. Screen readers and keyboard-only users rely on focus to operate rich Internet applications with the keyboard.

3.2.1. Tabindex

One requirement for supporting the keyboard is to allow focus to be set to any element. The tabindex attribute can be used to include additional elements in the tab order and to set programmatic focus to them. Originally implemented in Internet Explorer 5, the feature has been extended to Opera, Firefox, and Mozilla. The following table outlines the use of the tabindex attribute:

Use of the Tabindex Attribute
Tabindex Attribute Focusable with mouse or JavaScript via element.focus() Tab Navigation

not present

Follows default behavior of element (only form controls and anchors can receive focus.) Follows default behavior of element

zero - tabindex="0"

yes In tab order relative to element's position in document

Positive - tabindex="X" (where X is a positive integer between 1 and 32768)

yes Tabindex value directly specifies where this element is positioned in the tab order.

Negative - tabindex="-1"

yes No, author must focus it with element.focus() as a result of arrow or other key press

Setting a tabindex value of -1 to an element allows the element to receive focus via JavaScript using the element.focus() method. This method is used to enable arrow key navigation to elements. Each element that can be navigated to via arrow keys must have a tabindex of -1 to enable it to receive focus. Here are just a few additional tips to help you with managing keyboard focus:

  • Use onfocus to track the current focus - The events onfocus and onblur can now be used with every element. There is no standard DOM interface to get the current document focus, so if you want to track that you'll have to keep track of it in a JavaScript variable. Don't assume that all focus changes will come via key and mouse events, because assistive technologies such as screen readers can set the focus to any focusable element, and that needs to be handled elegantly by the JavaScript widget.

  • Follow keydowns to move focus - A keydown event handler can determine the next object to receive focus and call that element's focus() method.
  • Use onkeydown to trap key events, not onkeypress - Internet Explorer will not fire keypress events for non-alphanumeric keys.
  • Refresh an elements style using onfocus() - An element's style may require an update via an onfocus event handler in order to show the focus, because browsers are inconsistent in displaying focus for items that receive focus programmatically.
  • Dynamically change focusability using the tabIndex property - You may want to do this if a custom control becomes disabled or enabled. Disabled controls should not be in the tab order. However, you can typically arrow to them if they're part of grouped navigation widget.
  • Use setTimeout with element.focus() to set focus - Do not use createEvent(), initEvent() and dispatchEvent() to send focus to an element, because DOM focus events are considered informational only -- generated by the system after something is focused, but not actually used to set focus. The timeout is necessary in both IE and Firefox 1.5, to prevent scripts from doing strange unexpected things as the user clicks on buttons and other controls. The actual code to focus an element will look something like this:
    window.setTimeout(function () { focusItem.focus(); },0);  // focusItem must be in scope
  • Don't use :focus or attribute selectors to style the focus - You will not be able to use :focus or attribute selectors to style the focus if you want the focus to appear in Internet Explorer. Set the style in an onfocus event handler. For example, in a menu item's focus handler add this.style.backgroundColor = "gray";
  • Always draw the focus for tabindex="-1" items and elements that receive focus programatically - Internet explorer will not automatically draw the focus outline for items that programatically receive focus. Choose between changing the background color via something like this.style.backgroundColor = "gray"; or add a dotted border via this.style.border = "1px dotted invert". In the dotted border case you will need to make sure those elements have an invisible 1px border to start with, so that the element doesn't grow when the border style is applied (borders take up space, and IE doesn't implement CSS outlines).
  • Prevent used key events from performing browser functions - If a key such as an arrow key is used, prevent the browser from using the key to do something (such as scrolling) by using code like the following:
    <span tabindex="-1" onkeydown="return handleKeyDown();">   

    If handleKeyDown() returns false, the event will be consumed, preventing the browser from performing any action based on the keysroke.

  • Use key event handlers to enable activation of the element - For every mouse event handler, a keyboard event handler is required. For example, if you have an onclick="doSomething()" you may also need onkeydown="return event.keyCode != 13 || doSomething();" in order to allow the Enter key to activate that element.

  • Consider using a "roving" tabindex for complex widgets if you are not using the activedescendant property.

3.2.2. Using activedescendant vs. tabindex to manage focus for widget children

ARIA provides two techniques for managing the focus of child elements within a widget. Widgets like grid and tree typically manage their children. The root element of the widget should have a tabindex value greater than or equal to "0" to ensure that the widget is in the document tabbing order. Rather than setting a key event handler on each element within a larger component, the event handler can be set on the parent element such as the tree. It will be job of the parent element to manage the focus of the children.

The parent may use the activedescendant property to indicate the active child. For example, the container element with the role of tree can provide an onkeydown event handler so that each individual tree item within the tree does not need to be focusable and to listen for the keydown event. The container object, in this case the tree, needs to maintain the point of regard and manage which individual child item must be perceived as active.

Important: For a given container widget where activedescendant must cause focus events to be fired to ATs, the actual focus must be on the container widget itself. In HTML this is done by putting tabindex="0" on the container widget.

The key handler on the parent captures the keystrokes and determines what item becomes active next and updates the activedescendant property with the ID of the appropriate, next active child element. The browser takes that ID information and generates the focus event to the assistive technology. Each individual element does not have to be made focusable via a tabindex value of -1, but it must be styled using CSS to indicate the active status

An alternative to using activedescendant is to have the parent element, in response to the same keyboard input, move focus to its children by first removing tabindex from children that do not have focus, which removes them from the tab order. This would be followed by setting the tabindex to "-1" on the element which is to receive focus and then using script to set focus on the element to receive focus. Like with activedescendant this leaves managed children out of the tabbing order. For browsers which do not yet support activedescendant, this allows keyboard navigation to be maintained and it will provide focus notification to many assistive technologies like screen magnifiers to move visual focus and which are not reliant on other ARIA properties. Today, this technique will work in more user agents, but in the long run activedescendant will require less work by the developer.

3.2.2.1. Managing Visual Focus with activedescendant

Although not always ideal based on the widget you are creating, a benefit of using tabindex to manage focus on an element is that the user agent will scroll the element into view when focus is set to the it. This is not the case for activedescendant. When setting or updating the activedescendant property, e.g. aria-activedescendant="cell23", authors will want to ensure that the element with id "cell23" is in view. In either case, it is important that you consider position your widget into the visible area of your browser to maximize usability. This can be achieved using available JavaScript scrolling functions.

In some browsers a JavaScript call to scrollIntoView() on this element should suffice, but in browsers, where this is unreliable, authors should explicitly set the scrollTop and scrollLeft properties of the "cell23" element and its ancestors to position the scroll the element into view. scrollTop and scrollLeft adust the node positions by the amounts(pixels) needed to scroll a node into view.  Scrolling values are adjusted by the amounts(pixels) needed to scroll a node into view. This is done by comparing the sizes of the nodes using available measurements such as scroll+offset+clientWidth/Height/Left/Top. It's important to note that you have to adjust a node so that its viewable within the context of its parent node.  Then you have to move up the DOM tree and make each parent node visible.

The Dojo Dijit library explicitly calls its own implementation of scrollIntoView, dijit.scrollIntoView, at various times, including coincidence with the setting of the activedescendant property. Dojo's implementation of scrollIntoView takes a DOM node argument, say "n". Here is the high level algorithm:

  1. If n is already in view, stop; otherwise, continue.
  2. adjust n.scrollTop and n.scrollLeft such that it is in view.
  3. adjust scrollTop and scrollLeft for the ancestor nodes of n such that that the region of the ancestors which n consumes is visible.

dijit.scrollIntoView implements a minimum-position-change algorithm.

Understanding how the DOM scrollIntoView works across browsers is important. Browsers (including Firefox3) force the node either to the top or the bottom of the screen (as defined by the single boolean parameter) even if its already in view. This is problematic when you only need to scroll horizontally to see the element. It is also problematic when when the node is partially off the bottom of the screen and the parameter is (true) which forces the node all the way to the top, and vis-a-versa with the top going to the bottom on (false). IE forces the node to the left of the client area (or right in right-to-left mode) even if it's horizontally in view already.

The scrollTop and scrollLeft functions create some challenges. scrollTop is always accurate but misleading with respect to inner (nested) scrollbars. scrollLeft cannot be relied on in right-to-left languages since it is sometimes negative and sometimes positive especially with respect to inner (nested) scrollbars. Different browsers handle right-to-left completely differently.

3.2.3. Author-Defined Keyboard Short-Cuts or Mnemonics

Author-defined keyboard short-cuts or mnemonics present a high risk for assistive technology users. Because they are device-, browser-, and AT-dependent, conflicts among key bindings is highly probable. Therefore, if you needed to use accesskey, you should be aware that it will behave differently in
different browsers. It also may not work with small devices so it is still advisable to ensure that all features are accessible with the basic keys like Tab/shift+tab, arrow, Enter, space and Escape.

The XHTML 2 Working Group is currently developing a new Access Module to address this issue and we hope to have it or a feature like in future versions of (X)HTML. Refer to Section 9: Implemenation Guidance.

3.3. Supporting Tooltips with the Keyboard

A tooltip is a popup messages typically triggered by moving a mouse over a control or widget causing a small popup window to appear with additional information about the control. If you want to have simple text tooltips the HTML title attribute should more than suffice as the user agent will render this for tooltips. When creating a tooltip it is essential that the user must be able to activate it using the keyboard. When a form control or widget receives keyboard focus, the tooltip must display. When the form control or widget loses focus, the tooltip must disappear.

The following is a code snippet of working tooltips from the iCITA site.

<html lang="en-us">  
<head>    
   <title>inline: Tooltip Example 1</title>      
   <link rel="stylesheet" href="css/tooltip1_inline.css"  type="text/css">    
   <script type="text/javascript" src="js/tooltip1_inline.js"></script>    
   <script type="text/javascript" src="../js/widgets_inline.js"></script>
   <script type="text/javascript" src="../js/globals.js"></script>          
   <link rel="icon" href="http://www.cites.uiuc.edu/favicon.ico" type="image/x-icon">    
   <link rel="shortcut icon" href="http://www.cites.uiuc.edu/favicon.ico" type="image/x-icon"> 
</head>
   ...   

   <body onload="initApp()">

   <div id="container">

   <h1>Tooltip Example 1</h1>
   <h2>Create Account</h2>
   <div class="text">
   <label for="first">First Name:</label> 

   <input type="text"  id="first" name="first" size="20" onfocus="tooltipShow(event, this, 'tp1')" 
          onmouseover="tooltipShow(event, this, 'tp1')"          
          aria-describedby="tp1"  		 
          aria-required="false"/>

   <div id="tp1" role="tooltip" aria-hidden="true">Your first name is a optional </div>    
   </div>
  ...

3.4. Providing Navigable Structure within Web Pages

This section takes a broader look at the web page. It is intended to assist you in conveying a logical, usable, and accessible layout to an assistive technology or adaptive system designed to modify the visual layout to meet the users needs.

One of the deficiencies of (X)HTML for disabled users has been the usability of keyboard navigation. Users, dependent on a keyboard for navigation, have been forced to tab everywhere in the document as the only document elements which are keyboard accessible are form and anchor elements. This has forced developers to make most everything a link to make it a keyboard accessible and to get to each link you have to tab to it. With the advent of portals and other content aggregation means web pages are divided into visible regions and there has been no vehicle to get to them other than perhaps to do things such as:

There are number of problems with this approach:

This remainder of this section provides the author with a playbook for using WAI-ARIA to add semantically rich navigation structure in a web page so that an assistive technology may provide an effective user experience and avoid these shortcomings.

3.4.1. Steps for defining a logical navigational structure

One of the deficiencies of (X)HTML for disabled users has been the usability of keyboard navigation. Users, dependent on a keyboard for navigation, have been forced to tab everywhere in the document as the only document elements which are keyboard accessible are form and anchor elements. This has forced developers to make most everything a link to make it a keyboard accessible and to get to each link you have to tab to it. With the advent of portals and other content aggregation means web pages are divided into visible regions and there has been no vehicle to get to them other than perhaps to do things such as:

  • Create a skip link at the top of the page to the main content
  • Make the head of each perceivable region (search bar, stock quote, TV Listing, etc.) an <H1> tag

There are three problems with this approach:

  • Both force the user interface to change to support accessibility
  • In the case of using <H1> to mark your regions, this is not consistent across web sites
  • The semantics are limited to main content and a section

Follow these steps to assign to mark each logical section:

  1. Identify a the logical breakdown structure of your page

    Break up your page into perceivable block areas which contain semantically associated information called "regions". You can further breakdown each region into logical regions as needed. This is a common process undertaken by portal developers who break the page into perceivable regions called portlets. Think about the user wanting to navigate to these logical block areas on your web page. Write down a description of what you believe each region to be.

    Depending on your web application you may then need to break it into sub regions depending on the complexity of your web application. This is a recursive process. A user will look at these perceivable areas like pealing an onion. You might have an outermost collection of perceivable regions or block areas and upon entering each region you may have a collection of regions within it.

  2. Implement the logical structure in markup

    Implementing the block structure in markup often involves wrapping elements contained with a "region" such as a <div> or <iframe> with perceivable borders so that each perceivable region or block area is perceivable to the user.

  3. Label each region

    Once you have broken up each region you need to label it. The start of each region must have a perceivable header and it should be used to label the region. For details on how to do this see section 3.4.3.1 Header Levels vs. nesting level to create a header to label each region. If you're finding it difficult to come up with a label for the region, make sure at least to use one of the standard roles defined in the following step. The drawback of not providing a label is that users will not know the purpose of the region. By definition, regions would be included in a summary of a page. If an assistive technology were to summarize it would be unable to provide information about the section without a label.

  4. Assign landmark roles to each region

    Now that you have your regions labelled you need to assign them semantic navigation landmarks. Landmarks are a vast improvement over the rudimentary "skip to main content" technique employed prior to WAI-ARIA. If possible it is best to use these as landmarks. Skip to main content links impact the layout of applications and only address one main content area. WAI-ARIA provides a collection of landmarks which are applied to each of the regions you identified in step 2.

    The presence of common, semantic, navigation landmarks allows each site to support the same standard and allows your your assistive technology to provide a consistent navigation experience - an important feature for screen readers and alternate input solutions. For users with cognitive and learning disabilites the landmark information could be used to expand and collapse these regions of your page to aid in simplifying the user experience by allowing the user to manage the amount of information processed at any one time.

    There are also mainstream benefits of providing navigation landmarks. Your browser may assign key sequences to move focus to these sections as they can be set on every site. Navigation to these landmarks is device independent. A personal digital assistant (PDA) could assign a device key to get to them in your document. These are the common landmarks included in WAI-ARIA.

    article

    Represents a section of a page consisting of a composition forming an independent part of a document, page, or site.

    An article could be a forum post, a magazine or newspaper article, a Web log entry, a user-submitted comment, or any other independent item of content. It is "independent" in that its contents could stand alone, for example in syndication. However, the element is still associated with its ancestors; for instance, contact information that applies to a parent body element still covers the article as well. When nesting articles, the inner articles represent articles that are in principle related to the contents of the outer article. For instance, a Web log entry on a site that accepts user-submitted comments could represent the comments as articles nested within the article for the Web log entry. Author, heading, date or other information associated with an article does not apply to nested articles. Assistive technologies must treat and article like a document in that article must must be processed like an application. Unlike a document, the use of articles allows the user to identify them and follow related articles based on the nesting. region that contains the prime heading or internal title of a page. Most of the content of a banner is site-oriented, rather than being page-specific. Site-oriented content includes things such as the logo of the site sponsor, the main heading for the page, and site-specific search tool. Typically this appears at the top of the page spanning the full width.

    banner

    A region that contains the prime heading or internal title of a page. Most of the content of a banner is site-oriented, rather than being page-specific. Site-oriented content includes things such as the logo of the site sponsor, the main heading for the page, and site-specific search tool. Typically this appears at the top of the page spanning the full width.

    complementary

    Any section of the document that supports but is separable from the main content. There are various types of content that would appropriately have this role. For example, in the case of a portal, this may include but not be limited to show times, current weather, or stocks to watch. The content should be relevant to the main content; if it is completely separable, a more general role should be used instead.

    contentinfo

    Meta information about the content on the page or the page as a whole. For example, footnotes, copyrights, links to privacy statements, etc. would belong here.

    main

    Main content in a document. This marks the content that is directly related to or expands upon the central topic of the page.

    navigation

    A collection of links suitable for use when navigating the document or related documents.

    search

    The search tool of a web document. This is typically a form used to submit search requests about the site or to a more general Internet search service.

    To set the landmark in you page:

    <div role="main"> ... <div role="complementary" title="weather">  
    
  5. For the landmarks that just won't fit use the region or specialized region ARIA roles

    If you would like to use create your own custom regional landmarks you can by making use of any one of the following WAI-ARIA regions and labelling them with a title attribute or :

    It is not essential to label these specialized regions when they are used as a widget such as in the case of log and status but you should provide a title. When using the region role you should label the region with a header so that the name of the region is accessible to all users just as you would the standard regional landmarks. See Header levels versus Nesting levels for directions on how to label the region.

    <div role="log" title="chat log">
    <div role="region" title="Game Statistics">  

    Note: the region role is generic and should only be used when a more specific role is not applicable. Assistive technologies will treat this role as a a complementary region.

  6. Indicate to the assistive technology who controls the keyboard navigation

    Today's screen readers for the blind have been designed to give the user a "browsing" experience meaning the screen reader consumes a number of keys to aid in the browsing experience. For example, the "up" and "down" arrow keys are used to read the next and previous line of text on your web page. Accessible Rich Internet Applications will use these keys in an application to navigate within "widgets" like a Tree View.

    Assistive technologies must be able to identify widgets which implement WAI-ARIA and allow them use of the keyboard. However, if you have used used numerous widgets to form an application you must set the role on the encompassing region to application. Should you have regions which should be browsed as documents within the application region you should mark those regions with a document role as needed. See section 3.4.2 Structural Roles used to facilitate assistive technology navigation.

3.4.2. Structural roles used to facilitate assistive technology navigation

While ARIA is designed to address many disabilities, this section is best described in terms of screen reader use. In desktop applications, screen readers typically treat widgets as discrete entities, reading and interacting with each widget one at a time. The user moves the point of focus from widget to widget using tab/shift tab, mnemonics, or accelerators, keyboard commands which are usually provided by the application or the operating system. We refer to this mode of interaction as "application mode."

When viewing web content however, screen readers often gather information about all the widgets in an area and present them in a document-like view which the user navigates using keyboard commands provided and controlled by the screen reader. Think of this mode as a virtual environment that presents web content in a way that makes it convenient for adaptive technology users to navigate and read. This is sometimes called browse mode, or virtual mode. We refer to this as "document browse mode."

Because screen readers often provide document mode navigation support using single key mnemonics on the alpha-numeric keyboard, they may provide a third mode, called "forms mode," used to interact with form controls that are encountered in document mode. Behavior in forms mode is similar to that of application mode. The key feature of forms mode is that it can be toggled with document mode to make it easy to both interact with a specific widget, and read virtualized content of which the widget is a part. Since, as described above, a screen readers perception of an area as either a document or an application greatly influences how the user reads and interacts with it, ARIA provides content authors a way to indicate whether their pages must be viewed as applications or documents by assistive technologies.

To set document or application mode follow these steps:

  1. Set the Application Role

    After you have divided your web page into regions through the use of role landmarks and custom regions, you must make a decision: Is your web page an application or not? If it is, set the role of application on the body tag as follows:

    <body role="application"> 

    When using application, all static text must be associated with widgets, groups or panes via using the labelledby and describedby properties, otherwise it will not be read by the screen reader when the user navigates to the the related widget or group.

    Special Considerations:

    • If you have selected to have a role of application on the body tag it is recommended that a widget have focus after the page is first loaded.
    • If when your page loads and you should have have focus on a widget this is a strong indicator that your web page should have role of application.
    • If your page has only a few isolated widgets, like pop-up calendars located on a web page, it is not necessary to expressly set the role of application on the body. Screen readers, based on widget roles, must be able to provide access to these widgets without recognizing the entire page as an application.
    • Also, browsers make use of a feature called the contenteditable attribute, which will be incorporated into HTML 5. Contenteditable allows an author to turn the browser section into a rich text editor, similar to a word processor. Any section which has contenteditable set to "true" is considered a widget.
    • If the body element has been given the role of application, please follow step 3. Otherwise, the web page is considered a document, and no further action is required in this regard.
  2. Dialogs and Alert Dialogs - special case application roles

    WAI-ARIA provides dialog and alertdialog roles which are to be treated as special case application roles. Like application, screen readers will leave the main job of keyboard navigation up the the application.

    When using dialog, all static text must be associated with widgets, groups or panes via using the labelledby and describedby properties, otherwise it will not be read by the screen reader when the user navigates to the the related widget or group. Unlike an application, your web page is unlikely to start out as either of these two roles but rather the author is most likely to dynamnically create dialogs or alertdialog sections within the web page.

    Unlike dialog, descriptive text of the alert does not need to be associated via a relationship as the contents of alert dialogs will be read automatically by the screen reader when the dialog opens.

  3. Set the Document Role

The default mode for a screen reader to be processing an HTML web page is document browse mode. This is equivalent to having a role of document on the HTML <body> tag. If you have already specified a role of application on the body tag there may be times in which you tell the screen reader to switch into "document browse mode" and start stealing the necessary keys to browse a document section of your web page. These keys are the typical keys used by WAI-ARIA widgets and to provide this level of navigation the keys must be stolen from your browser.

To mark areas of your page to tell the assistive technology when to switch into document browse mode, look at the regions/landmarks you have defined and determine which ones must be browsed as a document or navigated as an application. For each region which must be browsed in document browse mode, embed a div element within it with the role of document as follows:

<div role="document"> 

Now, when a screen reader encounters this region, it will change its interaction model to that of document browsing mode.

3.4.3. Implicit Nesting and Headings

This section discusses the use of the heading role and nesting levels.

3.4.3.1. Header Levels versus Nesting Levels

The heading role value signifies a heading for a section of the document instance. Use of the heading role indicates that a specific object serves as a header. The region of the document to which the heading pertains to should be marked with the labelledby property containing the value of the id for the header.. If you have a heading and there is no element containing the content that it heads, wrap the content in a <div> bearing this labelledby attribute. If headings are organized into a logical outline, the level property can be used to indicate the nesting level. Here is an example:

<p role="main" aria-labelledby="hdr1">

 <div role="header" id="hdr1">
    Top News Stories

 </div>

</p>
3.4.3.2. Owns Repairs Nesting

Assistive technology briefs users on the context where they are. When they arrive at a new page, a page summary may be given. When they move into a new context, some of the labeling from elements containing the new focus or reading location may be rendered by the assistive technology, to give context to the details to be read next.

The syntactic structure of a page provides the default nesting of contexts. If a paragraph is nested in a <div> or table cell, it is assumed that labels for the <div> or headers for the table cell are pertinent to what is in the paragraph. On the other hand, it is not possible to always flow the logical structure one-to-one into the parse structure.

The owns relationship is provided to annotate logical nesting where the logical child is not a syntactic descendant of the logical parent. In a Rich Internet Application, updates may be made to the the document without updating the logical synctactic structure, yet elements may appear to be added to the document structure. From a DOM and accessibility hierarchy perspective owns is a fallback mechanism to using the tree hierarchy provided in the DOM. An example of where owns is needed is a treeitem children where, children in a folder subtree are added to a visible subtree but not be reflected in the actual document subtree of the folder. The owns relationship can be used to associate the folder with new "adopted" child. For more details on thue use of owns see section 4.2 Owning and Controlling. The owns relationship is used to indicate to a user agent that a menu is an adopting parent of a sub menu. Another use for owns is a hierarchical diagram where the child nodes of the diagram are not be adequately represented using the DOM structure.

3.4.4. Grouping, Regions, and Directories

3.4.4.1. Groups and their applicability

A group is a section of related user interface objects which would not be included in a page summary or table of contents by an assistive technology. Sections of user interface objects that should be included in a page summary or table of contents must be identified as a type of region. Unlike a group, A heading is used to label a section which forms a region. The region and its heading are normally perceivable in the context of the document.

Authors should use a role of group to form logical collections of items in a widget such as a:

  • a row in a grid;
  • a group of children in a tree widget forming a collection of siblings in a hierarchy; or
  • a group of items having the same container in a directory

Proper handling of group by assistive technologies, therefore, is determined by the context in which it is provided. Group members that are outside the DOM subtree of the group need to have explicit relationships assigned for them in order to participate in the group. Groups may also be nested.

If an author believes that a section is significant enough in terms of the entire document instance, then the author must assign the section a role of region or one of the designated standard XHTML Role landmark. The designated landmark roles are listed in the section Regions and XHTML Role landmarks..

3.4.4.2. Regions vs. groups

The term region defines a group of elements that together form a large perceivable section of a document instance, which the author feels must be included in a summary of page features, such as a "Table of Contents" or "Summary of Regions."

When defining a region for a section of a document, authors must consider using standard document landmark roles defined by the XHTML Roles Module. This makes it possible for user agents and assistive technologies to treat roles as standard navigation landmarks. If the definition of these regions is inadequate, authors must use the ARIA region role and provide the appropriate title text. For more information on the use of region see Regions and XHTML Role landmarks.

Unlike regions, groups are used to associate a small groups of widgets, with related functionality but they should not be considered as major perceivable sections on the page. As such, a group, would not appear in the "Table of Contents" of your page. A group may be delineate a set of treeitems having the same level in the tree or it may be used to group a set of related checkboxes in a form.

3.4.4.3. Directories and their applicability

The ARIA role, directory, allows authors to mark static table of content sections of a document. Prior to ARIA, the user would need to guess if an area of a document actually pertained to the table of contents. Authors should mark these sections within a document with a role of directory.

<div role="directory">
   <ul>
      <li>Global Warming Causes
          <ul>
             <li>CO2 Buildup</li>
             <li>Auto emissions<li>
             <li>Factory emissions</li>
             <li>Destruction of rainforests</li>
          </ul>

      </li>

      <li>Tailoring CO2 buildup</li>
          <ul>
             <li>Elimination of the incandescent light bulb</li>
             <li>Hydrogen fuel cells</li>
             <li>Solar energy</li>
             <li>Wind power</li>
          </ul>

      </li>  
   </ul>

</div>
3.4.4.3.1. Use of the presentation role vs. CSS

An element whose role is defined as presentation does not need to be mapped to the accessibility API. The presentation role's intended use is to mark an element which is used to change the look of the page, such as a TABLE used to control layout, but which does not have all the functional, interactive, or structural relevance implied by the element type for which the presentation role is defined.

A user agent may remove all structural aspects of the element being repurposed. For example, a table marked as presentation would remove the table, td, th, tr and any other child elements of TABLE, while preserving the individual text elements within it. Because the user agent knows to ignore the structural aspects implied in a TABLE, no harm is done by using a table for layout.

The following is an example for using the ARIA presentation role to convey layout:

<table role="presentation">
  <tr>
    <td>see</td>
    <td>spot</td>
    <td>run</td>
  </tr>  
  <tr>  
    <td>over</td>
    <td>the</td>
    <td>lazy coder</td>
  </tr>
</table>

All descendants of the element having a presentation role are still exposed, with the exception of table rows and cells on a table. So, if you were to have forms, images, and text within a table and the table had a role of presentation these elements would be exposed.

3.4.5. Remaining structural roles

3.4.5.1. Tabular structure related roles supporting tabular widgets

There are a number of structural roles which are used to support tabular widgets grid and treegrid which indicate additional keyboard navigation as well as the ability to select rows and/or columns. Typically, you would apply these roles to an underlying table in the base markup as shown here:

<table role="grid">		

However, in some instances that may not work for the developer, such as when the developer has need for a <div> or <span>, or additional semantics may be needed. To assist, the following roles are provided to support tabular widgets:

When constructing a grid or treegrid the author must use gridcell's for the actual cells:

<table role="grid">
   <tr>
      <td role= "columnheader">Apples</td><td role= "columnheader">Oranges</td>
   </tr>
   <tr>
      <td role="gridcell" aria-readonly="false">Macintosh</td><td role="gridcell">Valencia</td>
   </tr>
</table>

Gridcells are focusable within a grid unlike a table. They may also be editable as is shown in the above example.

Treegrid's may require expanding and collapsing rows which may not be performed using a <tr>. In these instances authors will use an HTML <div>. WAI-ARIA provides a role of row which may be assigned to the <div> to convey to the assistive technology that this is still a row. If you decide to not use the native HTML <table> elements and choose more flexible elements, such as <div> and <span>s, with applied WAI-ARIA roles in this section, you should structurally lay out your elements in line with what you would expect from HTML. All of your rowheaders should be in a row and your gridcells should be children of each subsequent row in the same format as HTML for <td>s and <th>s within <tr>s.

3.4.5.2. Marking Description sections

A new feature of ARIA is the ability to mark a description in your document that can then be associated with a section, drawing, form element, picture, and so on. This is unlike longdesc which typically required the author to create a separate file to describe a picture when it was preferred to have the descriptive text in prose as well so that it was readily available to all users.

<img src="foo" alt="" aria-describedby="prose1">

<div role="description" id="prose1">
   This prose in this div describes in detail the image foo.
</div>

This is the preferred vehicle for providing long descriptions for elements in your document.

3.4.6. Miscellaneous XHTML Section Roles

In order to be synchronized with the XHTML Role Attribute module, WAI-ARIA includes two XHTML roles which are neither landmarks or widgets of any kind. These roles were incorporated to replace standard elements found in host languages. These roles are definition and note. If either role has a corresponding element in the host language it recommended that authors use the corresponding element in the host language.

The definition role indicates a definition statement in your document.For HTML developers implementing lists of definitions, we recommend you using the DL, DT, and DD elements rather than marking an arbitrary element with a role of definition. An arbitrary element would be appropriate for inline definitions used in conjunction with the DFN element.

Example of an inline definition with an explicit labelledby relationship:

<p>The doctor explained it had been a <dfn id="placebo">placebo</dfn>, or <span role="definition" aria-labelledby"placebo">  
or an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span>
</p>

Example inline definition with an implicit labelledby relationship determined by nesting:

<p>The doctor explained it had been a <span role="definition">
<dfn>placebo</dfn>, an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span>
</p>

Note: In the case where host language semantics do not allow for implicit nesting of definitions terms inside definition roles, authors should explicitly use the aria-labelledby attribute, even when the definition term is nested in the definition as shown here:

<p>The doctor explained it had been a <span role="definition" aria-labelledby="placebo">
<dfn id="placebo">placebo</dfn>, an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span>
</p>

The following is an example using a definition list:

<dl>
 <dt id="anthema">anthema</dt>
 <dd role="definition" aria-labelledby="anthema">a ban or curse solemnly pronounced by ecclesiastical authority and accompanied by  
excommunication</dd>
 <dd role="definition" aria-labelledby="anthema">a vigorous denunciation : cursor</dd>
<dt id="homily>homily</dt>
<dd role="definition" aria-labelledby="homily">a usually short sermon</dd>  

<dd role="definition" aria-labelledby="homily">a lecture or discourse on or of a moral theme</dd>

</dl>

The note role defines a parenthetic or ancillary remark to the main content of the resource. It also allows assistive technologies to skip over this section of the document unless more information is requested about the main content.

<div role="main" aria-labelledby="foo">
   <h1 id="foo">Wild fires spread across the San Diego Hills</h1>
   Strong winds expand fires ignited by high temperatures ...
</div>

<div role="note">
   This article was last updated July 30, 2008 at 6:05PM. 
</div>

4. Relationships

4.1. Labeling and Describing

Marked up content or widgets will often need additional context to make clear what the meaning or purpose is. It is also reasonable that some content media types will need additional descriptions in another format to give clarity to those who are unable to consume the origin format. These additional meta-content sections are linked together by tagging them as labels or descriptions. ARIA provides the labelledby and describedby attributes to signal the browser to feed these relationships into the accessibility layer. This layer is then used by screen readers and other accessibility technology (AT) to gain awareness of how disparate regions are actually contextually connected to each other. With this awareness the AT can then present a meaningful navigation model for discovery and presentation of these additional content sections. The user agent itself can also choose to present these insights in a meaningful way. Generally you should always add these attributes to any widgets on your site as they are often merely a construct of HTML and JavaScript which provides no obvious insight as to what the widget's behavior or interactivity is.

4.1.1. Labelled By

A labelledby section needs to indicate what the object it labels does. For example, you could have a button in a webmail client which will erase a selected message. This button could be constructed out of any kind of HTML but with with the ARIA roles, states and other attributes the user will know it is a button. The button itself should have a basic behavioral explanation, such as "erase mail" but the user might not be familiar with this feature or webmail in general, so providing additional behavioral labeling will reduce fear and make the page more user friendly. The markup could look like this

<div role="button" aria-labelledby="eraseButton" tabindex="0">Erase Message</div> 

and elsewhere in the markup

<div id="eraseButton">Permanently erase the currently selected message titled "Nigerian Lottery"</div> 

This would give the user and any running AT additional information about the expected behavior if the button widget is activated. In this particular case, the <div> content has been updated to reflect the current context to make it more obvious exactly what the effect of the action will be. The section doing the labeling might be referenced by multiple widgets or objects as these need only reference the same id, so contextual description may not always be viable. The labelledby attribute can have multiple ids specified as a space separated list much like applying multiple classes to a single DOM object.

It should be noted that (X)HTML provides a <label for> element which you can use to label form controls. For all visual objects, including (X)HTML form elements, you should may the WAI-ARIA labelledby property for labelling.

4.1.2. Described By

A describedby section provides further information about a given object or widget, which may not be intuitively obvious from the context, content or other attributes. For example, a fake window is a common widget used in web applications and is often constructed using a div absolute positioned in a layer above other content. To simulate common window behavior look and feel there is often an X box in the corner which, when activated, dismisses the window widget. One common way to make this X box is to simply make a link whose content is an X. This doesn't give a non-visual user much to go on and belies the real purpose of the X link. To help we add more descriptive text stored elsewhere in the page like this:

<a role="button" aria-describedby="winClose" href="#" onclick="fakewin.close()">X</a> 
and then elsewhere in the HTML
<div id="winClose">Closing this window will discard any information 
  entered and return you back to the main page</div> 
Like labelledby, describedby can accept multiple ids to point to other regions of the page using a space separated list. It is also limited to ids for defining these sets. In our contrived example we would also want a good labelledby section to fully explain what the window does and how closing will effect the task being worked on. If an object or widget lacks describedby the user agent or AT may try to extract information from the label or th tags, if present. The label and th tags have limited use in that they can only be applied to forms or tables, respectively.

ARIA also defines the description and tooltip roles to which describedby may reference to assign a description (which could span multiple document elements) and an author defined tooltip. The assistive technology can tell from the type of object describing the document element what the purpose of that element is. For example, a screen reader could announce the tooltip without the user having to waive the mouse over the element by following the describedby relationship to a document area with a tooltip role. The describedby property is also useful for describing groups.

Here is a code snippet showing a set of the tooltip:

...    
  <div class="text">
    <label for="first">First Name:</label>
      <input type="text"               
          id="first"           
          name="first"            
          size="20"           
          onfocus="tooltipShow(tooltip1)"          
          onblur="tooltipHide(tooltip1)"
          onmouseover="tooltipShow(tooltip1)"           
          onmouseout="tooltipHide(tooltip1)"           
          aria-describedby="tp1"
      />
  <div id="tp1" class="tooltip" role="tooltip">Your first name is optional</div>    
  </div>    
...  

4.2. Owning and Controlling

Two relationships expand the logical structure of a WAI-ARIA Web application. These are owns and controls .  The owns relationship completes the parent/child reltionship when it cannot be completely determined from the DOM created from the parsing of the markup. The controls relationship defines a cause and effect relationship so that assistive technologies may navigate to content effected by and changes to the content where the user is operating.

4.2.1. The owns relationship.

Assistive technologies are dependent on knowing the parent, or owner, of an object the person is working on to provide context where the user is operating. Typically, this can can be determined from a parsing of your web page into a DOM, forming of a tree hierarchy, that allows an assistive technology to request the "parent" of the the object they are working on. An example where this is important is a treeitem. Here, the user often asks for the the container parent such as a folder name. In rich internet applications, only a subset of the treeitems may be available at any one time and they may be added dynamically without modification to the DOM tree hierarchy - a common occurence in Ajax applications.

WAI-ARIA allows the the author to identify "adopted" children solution through the use of the owns property. The owns relationship property establishes owernship of an element when applied to an element in the web page.  In these situations, adopted children are visually rendred to be contained in or managed by a "perceived" parent when actually they are not natural children as would be found in a parsed DOM. The owns attribute must appear on any element whose logical contents includes elements nested within it and also other content not found among its syntactic descendants (determined from the DOM). The value of the attribute is a list of 'id' attribute values for the additional logical children that are not syntactic descendants. Let us call the elements whose IDs appear in the 'owns' attribute value as the adoptive children and the children by textual inclusion natural children.

Natural and adopted children must be presented to users in a way such that the user will perceive them to be part(s) of the logical parent and peers of each other. Each child, adopted or natural, should each have the appropriate posinset and setsize properties set consistent with their rendering if the cannot be determined from the DOM from a direct parsing of the host language. Places where direct parsing does not allow the user agent to determine posinset and setsize are long lists where only the currently visible items are loaded (via Ajax). If the children are resorted then the posinset and setsize values should be updated consistent with their visual rendering.

Platform accessibility API must invert this relationship for assistive technologies so that they may determine the owning parent from a child and couple it with posinset and setsize information to provide context information to the user.

4.2.2.  Using owns with reuse.

If you are re-using content across different, transient sections of content by restyling it to render it in association with a different object, you need to maintain the owns property as well to match the current use and apparent ancestry of the reused sub-section. A good example of this is a context help menu that resides at the end of the document. When the user wish to launch the context help menu in association with different visual elements, styling is used to render the menu in context with that object. Prior to rendering the visual submenu you should ensure the object to which you have requested help assigns its owns property value to the submenu id. When the menu closes you can remove the owns property.

4.2.3. The controls relationship.

In Rich Internet Applications document elements may control the behavior on another part of web page outside themselves. The controls attribute indicates cause-and-effect relationships between document elements.

An example might be a group of radio buttons that "control" contents of a listbox in another part of the page. Here, you would want the radio group to assign a controls relationship to the listbox which will be updating without a page reload. The user, through their assistive technology can then navigate to the listbox by following the controls relationship, when a different radio is selected, to see how the contents changed in the listbox. The ability to update parts of a page without a page reload is a common practice of applications making use of Ajax. Without the controls attribute, a user would be unable to effectively use these types of web pages as assistive technologies often will not make the user aware of what is happening outside the context of the element the user is currently operating.

With the controls attribute the user may use the assistive technology to follow the relationship to the object it is controlling. It is extremely important for an assistive technology to present changes in the document in response to user input. Therefore, an assistive technology immediately present changes to a live region when the controlling widget is the one which has user keyboard focus. For example, if a tree view controls a help document pane, each time
the tree item changes the new tree item and then the new help contents should also be read. In the case of a screen reader, the amount of information information read in the target live region is dependent on how the live region is configured.

The controls attribute takes one or more ids which refer to the document element. If this relationship is not implied by the host language semantics, then the controlling element must be given a controls attribute with the IDs of the other elements where the changes will show up listed in the attribute value.

4.3. Changing the Reading Flow

(X)HTML suffers from a number of disadvantages in keyboard navigation today. One such example is the restriction of navigation to the tabbing order. This is a common problem with presentations in office suites where the logical, perceivable, navigation order of a slide may not match the tabbing order. Sighted users may see a logical navigation process (such as visual steps in the process for assembling a lawn mower). This "flow" is not conveyed by the tab order. The user might tab from step 1 and land on step 4. Another problem is the construction of model-based authoring tools on a web page. In a model-based authoring tool, a visual object may provide a number of paths that the user can take, such as a multiplexor, which may have output that logically flows to a number of optional electronic components in a drawing. In Web 2.0, developers are actually creating drawings like this to perform tasks such as visually model a work flow. In this scenario, the user will want to decide which object they will navigate their screen reader or alternate input device to next.

For these reasons, ARIA provides a relationship property, called flowto. This allows the author to provide an assistive technology with alternative navigation flows throughe the document that best represents the authros intent and which is more logical for people with disabilities. flowto establishes the recommended reading order of content, so that the an assistive may overriding the default of reading in document order to its user. flowto does not change the keyboard navigation order of they browser.

Consider the first case of changing a basic reading flow to circumvent(X)HTML tabbing. A good example of this is a logical reading flow in a portal with landmarks. In the future, the user may wish to change the reading flow based on the order of priority with which they navigate a personalized web application like MySpace or MyYahoo. In the following example, the navigation would follow the order of "Top News Stories", "television listings", "stock quotes", and "messages from friends" by following (X)HTML document reading order. However, the author or end user may determine that the main content is most important, followed by "stock quotes", "messages from friends", and then "TV listings."

<html>  
...  
<div role="main" title="Top News Stories" id="main" aria-flowto="stock"></div>  
<div role="complementary" title="television listings" id="tv"></div>
<div role="complementary" title="stock quotes" id="stock" aria-flowto="messages"></div>
<div role="complementary" title="messages from friends" id="messages" aria-flowto="tv"></div>  

The second use case is such that the web developer may wish to circumvent the flow by branching to multiple paths in the web page, requiring the assistive technology to present a collection of options where the user could go next. This is important for workflows or business process management applications as shown in this Process Designer Tool. More of these applications are becoming web based, and a vehicle is required to tell the user how to get through the work flow. The flowto property takes multiple idrefs, allowing the author to define each object the user could flow to. To implement this technique do the following.

5. Document Management

5.1. Managing Content and Presentational Changes

General rules for managing content and displaying information

If you are refreshing areas asynchronously, need to look at live regions, alert, status, log.

5.2. Implementing Live Regions

Live regions are parts of a web page that the web page author expects to change. Examples of live regions include tables with dynamically updated content (sports stats, stock information), logs where new information is being added (chat transcript logs), notification areas (status, alerts), etc.

Live regions ena