This document provides readers with an understanding of how to use WAI-ARIA 1.1 [[WAI-ARIA]] to create accessible rich internet applications. It describes considerations that might not be evident to most authors from the WAI-ARIA specification alone and recommends approaches to make widgets, navigation, and behaviors accessible using WAI-ARIA roles, states, and properties. This document is directed primarily to Web application developers, but the guidance is also useful for user agent and assistive technology developers.

This document is part of the WAI-ARIA suite described in the WAI-ARIA Overview.

Introduction

This section is informative.

The WAI-ARIA Authoring Practices Guide is intended to provide an understanding of how to use WAI-ARIA to create an accessible Rich Internet Application. It describes recommended WAI-ARIA usage patterns and provides an introduction to the concepts behind them.

This guide is one part of a suite of resources that support the WAI-ARIA specification. The WAI-ARIA suite fills accessibility gaps identified by the [[WAI-ARIA-ROADMAP]].

As explained in Background on WAI-ARIA, languages used to create rich and dynamic web sites, e.g., HTML, Javascript, CSS, and SVG, do not natively include all the features required to make sites usable by people who use assistive technologies (AT) or who rely on keyboard navigation. The W3C Web Accessibility Initiative's (WAI) Accessible Rich Internet Applications working group (ARIA WG) is addressing these deficiencies through several W3C standards efforts, with a focus on the WAI-ARIA specifications. For an introduction to WAI-ARIA, see the Accessible Rich Internet Applications Suite (WAI-ARIA) Overview.

With the understanding many prefer to learn from examples, the guide begins with a section that demonstrates how to make common widgets accessible with descriptions of expected behaviors supported by working code. Where it is helpful to do so, the examples refer to detailed explanations of supporting concepts in subsequent sections. The sections that follow the examples first provide background that helps build understanding of how WAI-ARIA works and how it fits into the larger web technology picture. Next, the guide covers general steps for building an accessible widget using WAI-ARIA, JavaScript, and CSS, including detailed guidance on how to make rich internet applications keyboard accessible. The scope then widens to include the full application, addressing the page layout and structural semantics critical to enabling a usable experience with assistive technologies on pages containing both rich applications and rich documents. It includes guidance on dynamic document management, use of WAI-ARIA Form properties, and the creation of WAI-ARIA-enabled alerts and dialogs.

Design Patterns and Widgets

This section demonstrates how to make common rich internet application widgets and patterns accessible by applying WAI-ARIA roles, states, and properties and implementing keyboard support.

Although users of Mac OS X are familiar with using the Command key instead of the Control key, the Command key is typically reserved for desktop applications and OS-level integration. Until device and platform independence can be addressed in WAI-ARIA 2.0, the primary Control modifier key for WAI-ARIA widget interaction is specified as Control on all platforms, including Mac OS X.

Generally Applicable Keyboard Recommendations

The following keyboard conventions are applicable to many of the patterns described in subsequent sections.

The following guidance on nested widgets will be moved to another section.

Widgets within Widgets The general navigation model is for a user to tab to a widget, interact with the controls in that widget and then tab to move focus to the next widget in the tab order. By extension, when the construct of a widget contains another widget, tab will move focus to the contained widget because it is the next item in the tab order. This continues down the layers of widgets until the last widget is reached. For example, if there are two widgets A and B on a page where widget A contains within it Widget A1 and Widget A1 contains within it Widget A2, the focus sequence when pressing the tab key would be A, A1, A2, B.

Accordion (Sections With Show/Hide Functionality)

An accordion is a vertically stacked set of elements, such as labels or thumbnails, that allow the user to toggle the display of sections of content. Each labeling element can be expanded or collapsed to reveal or hide its associated content. Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page.

Terms for understanding accordions include:

Accordion Header:
Label for or thumbnail representing a section of content that also serves as a control for showing, and in some implementations, hiding the section of content.
Accordion Panel:
Section of content associated with an accordion header.

In some accordions, there are additional elements that are always visible adjacent to the accordion header. For instance, a menubutton may accompany each accordion header to provide access to actions that apply to that section. And, in some cases, a snippet of the hidden content may also be visually persistent.

Keyboard Interaction

  • Enter or Space:
    • When focus is on the accordion header for a collapsed panel, expands the associated panel. If the implementation allows only one panel to be expanded, and if another panel is expanded, collapses that panel.
    • When focus is on the accordion header for an expanded panel, collapses the panel if the implementation supports collapsing. Some implementations require one panel to be expanded at all times and allow only one panel to be expanded; so, they do not support a collapse function.
  • Down Arrow (Optional): If focus is on an accordion header, moves focus to the next accordion header. If focus is on the last accordion header, either does nothing or moves focus to the first accordion header.
  • Up Arrow (Optional): If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header.
  • Home (Optional): When focus is on an accordion header, moves focus to the first accordion header.
  • End (Optional): When focus is on an accordion header, moves focus to the last accordion header.
  • Control + Page Down (Optional): If focus is inside an accordion panel or on an accordion header, moves focus to the next accordion header. If focus is in the last accordion header or panel, either does nothing or moves focus to the first accordion header.
  • Control + Page Up (Optional): If focus is inside an accordion panel, moves focus to the header for that panel. If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header.

WAI-ARIA Roles, States, and Properties:

  • Each accordion header is contained in an element with role button. The button label is the label for the associated accordion panel.
  • Each accordion header button is wrapped in an element with role heading that has a value set for aria-level that is appropriate for the information architecture of the page. If the native host language has an element with an implicit heading and aria-level, such as an HTML heading tag, a native host language element may be used. The button element is the only element inside the heading element. That is, if there are other visually persistent elements, they are not included inside the heading element.
  • If the accordion panel associated with an accordion header is visible, the header button element has aria-expanded set to true. If the panel is not visible, aria-expanded is set to false.
  • The accordion header button element has aria-controls set to the ID of the element containing the accordion panel content.
  • If the accordion panel associated with an accordion header is visible, and if the accordion does not permit the panel to be collapsed, the header button element has aria-disabled set to true.

Example

Accordion Example: demonstrates a form divided into three sections using an accordion to show one ssection at a time.

Alert

An alert is an element that displays a brief, important message in a way that attracts the user's attention without interrupting the user's task. Dynamically rendered alerts are automatically announced by most screen readers, and in some operating systems, they may trigger an alert sound. It is important to note that, at this time, screen readers do not inform users of alerts that are present on the page before page load completes.

Because an alert is intended to provide important and potentially time-sensitive information without interfering with the user's ability to continue working, authors should ensure alerts do not affect the keyboard focus. If there is a need to interrupt work flow, consider using an alert dialog

In most circumstances, authors should avoid making alerts disappear automatically. An alert that disappears too quickly can lead to failure to meet WCAG 2.0 success criterion 2.2.3. In addition, authors should be careful to avoid overuse of alerts. Frequent interruptions inhibit usability for people with visual and cognitive disabilities, leading to failures to meet WCAG 2.0 success criterion 2.2.4.

Keyboard Interaction

An alert (WAI-ARIA live region) does not require any keyboard interaction.

WAI-ARIA Roles, States, and Properties

The widget has a role of alert.

Example

Alert role example

Alert and Message Dialogs

This section is partially revised. Planned changes are being discussed in issue 54.

An alert dialog is a modal dialog that interrupts the user's workflow to communicate an important message and acquire a response. Examples include action confirmation prompts and error message confirmations. The alertdialog role enables assistive technologies and browsers to distinguish alert dialogs from other dialogs so they have the option of giving them special treatment, such as playing a system alert sound.

Keyboard Interaction

See the keyboard interaction section for the modal dialog pattern.

WAI-ARIA Roles, States, and Properties

  • The element that contains all elements of the dialog, including the alert message and any dialog buttons, has role alertdialog.
  • The element with role alertdialog has either:
    • A value for aria-labelledby that refers to the element containing the title of the dialog if the dialog has a visible title.
    • A value for aria-label if the dialog does not have a visible title.
  • The element with role alertdialog has a value set for aria-describedby that refers to the element containing the alert message.

Example

Developing an example implementation of this pattern is issue 101.

Button

A button is a widget that enables users to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation. A common convention for informing users that a button launches a dialog is to append "…" (ellipsis) to the button label, e.g., "Save as…".

In addition to the ordinary button widget, WAI-ARIA supports 2 other types of buttons:

The types of actions performed by buttons are distinctly different from the function of a link (see link pattern). It is important that the role of a widget matches the function it provides. Ideally, the role of the element also matches its visual appearance. But, occasionally an element may be visually styled as an icon or link but perform the action of a button. In these cases, the element should be given a button role. Designers should work to avoid conflicts between visual appearance and WAI-ARIA semantics.

Keyboard Interaction

With focus on the button, pressing the Space key or Enter key activates the button. Focus should behave appropriately for the type of action being performed. For example:

  • If activating the button opens a dialog, the focus moves inside the dialog. (see dialog pattern)
  • If activating the button closes a dialog, typically focus should return to the button that opened the dialog unless the function performed in the dialog context logically leads to a different element. For example, activating a cancel button in a dialog should always return focus to the button that opened the dialog. However, if the dialog is confirming a delete action that deletes the page from which it was opened, the focus must logically move to a new context.
  • If activating the button does not dismiss the current context, then focus should typically remain on the button after activation, e.g., an Apply or Recalculate button.
  • If the button action indicates a context change, such as move to next step in a wizard or add another search criteria, then it may be appropriate to move focus to the starting point for that action.
  • If the button is activated with a shortcut key, the focus should usually remain in the context from which the shortcut key was activated. For example, if Alt + U were assigned to an "Up" button that moves the currently focused item in a list one position higher in the list, pressing Alt + U when the focus is in the list should not move the focus from the list.

WAI-ARIA Roles, States, and Properties

  • The button has role of button.
  • An accessible label is required. By default, the accessible name is computed from any text content inside the button element. However, it can also be provided with aria-labelledby" or aria-label.
  • If a description of the button's function is present, the button element has aria-describedby set to the ID of the element containing the description.
  • When the action associated with a button is unavailable, the button displays in a aria-disabled state.
  • If the button is a toggle button, it has an aria-pressed state. When the button is toggled, the value of this state is true, and when not toggled, the state is false.

Example

Button role examples

Checkbox

WAI-ARIA supports two types of checkbox widgets:

  1. Dual-state: The most common type of checkbox, it allows the user to toggle between two choices -- checked and not checked.
  2. Tri-state: This type of checkbox supports an additional third state known as partially checked.

One common use of a tri-state checkbox can be found in software installers where a single tri-state checkbox is used to represent and control the state of an entire group of install options. And, each option in the group can be individually turned on or off with a dual state checkbox.

The user can use the tri-state checkbox to change all options in the group with a single action:

Keyboard Interaction

When the checkbox has focus, pressing the Space key changes the state of the checkbox.

WAI-ARIA Roles, States, and Properties

  • The checkbox has role checkbox.
  • The checkbox has an accessible label, preferably provided by a visible label associated using aria-labelledby.
  • When checked, the checkbox element has the state aria-checked="true".
  • When not checked, it has the state aria-checked="false".
  • When partially checked, it has the state aria-checked="mixed".
  • If a set of checkboxes is presented as a logical group with a visible label, the checkboxes are included in an element with role group that has the property aria-labelledby set to the ID of the element containing the label.
  • If the presentation includes additional descriptive static text relevant to a checkbox or checkbox group, the checkbox or checkbox group has the property aria-describedby set to the ID of the element containing the description.

Examples

  • Simple Two-State Checkbox Example: Demonstrates a simple 2-state checkbox.
  • Tri-State Checkbox With Grouping Label Examples: three example implementations that demonstrate how to make a widget that uses the mixed value for aria-checked and also show three different ways of labeling a collection of checkboxes so screen reader users can perceive that all members of the collection are part of a logical group.

Combo Box

Drafting this section is issue 31.

Dialog (Modal)

This section is partially revised. Planned changes are being discussed in issue 42.

A dialog is a window overlayed on the primary window. A modal dialog is designed to interrupt the user to, for example, prompt the user to confirm an action or enter information, and it traps or contains keyboard focus until the dialog is closed. ARIA has a special role for modal dialogs that convey a brief, important message to the user -- the alertdialog ( See the Alert Dialog design pattern).

Keyboard Interaction

  • Tab: Moves focus to the next focusable element inside the dialog. Pressing tab with focus on the last focusable element in the dialog moves focus to the first focusable element in the dialog.
  • Shift + Tab: Moves focus to the previous focusable element inside the dialog. Pressing shift-tab with focus on the first focusable element in the dialog moves focus to the last focusable element in the dialog.
  • Escape: Closes the dialog without taking any action.
  • Enter: Serves as the default submit action key if if the primary purpose of the dialog is to gather information
  • If the current focus item has Escape key behavior, the press of the Escape will be handled by the current item and the user may have to press Escape an additional time to close the dialog.
  • When the dialog is closed or cancelled focus should return to the element in the application which had focus before the dialog is invoked. This is usually the control which opened the dialog.
  • When a modal dialog opens focus goes to the first focusable item in the dialog. Determining the first focusable item must take into account elements which receive focus by default (form fields and links) as well as items which may have a tabindex attribute with a positive value.

WAI-ARIA Roles, States, and Properties

  • The element containing the dialog has a role of dialog.
  • The dialog box title is provided by either the aria-label or the aria-labelledby property.
  • The aria-describedby property may be set on the element with the dialog role to indicate which element or elements in the dialog contain content that describes the primary purpose or message of the dialog. Screen readers may automatically announce the specified description along with the dialog title and initially focused element when the dialog opens.

Example

Any examples referenced here that are hosted outside www.w3.org may have changed and may not accurately exemplify the guidance in this section. The APG task force is developing examples for APG version 1.1 that will be directly incorporated into the guide.

Dialog (Non-Modal)

Drafting this section is issue 59.

Grids : Interactive Tabular Data and Layout Containers

A grid widget is a container that enables users to navigate the information or interactive elements it contains using directional navigation keys, such as arrow keys, Home , and End. As a generic container widget that offers flexible keyboard navigation, it can serve a wide variety of needs. It can be used for purposes as simple as grouping a collection of checkboxes or navigation links or as complex as creating a full-featured spreadsheet application. While ARIA properties and assistive technologies use row and column nomenclature when describing and presenting the logical structure of elements with the grid role, using the grid role on an element does not necessarily imply that its visual presentation is tabular.

When presenting content that is tabular, consider the following factors when choosing between implementing this grid patern or the table pattern.

Uses of the grid pattern broadly fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). Even though both data grids and layout grids employ the same ARIA roles, states, and properties, differences in their content and purpose surface factors that are important to consider in keyboard interaction design. To address these factors, the following two sections describe separate keyboard interaction patterns for data and layout grids.

Data Grids For Presenting Tabular Information

A grid can be used to present tabular information that has column titles, row titles, or both. The grid pattern is particularly useful if the tabular information is editable or interactive. For example, when data elements are links to more information, rather than presenting them in a static table and including the links in the tab sequence, implementing the grid pattern provides users with intuitive and efficient keyboard navigation of the grid contents as well as a shorter tab sequence for the page. A grid may also offer functions, such as cell content editing, selection, cut, copy, and paste.

In a grid that presents tabular data, every cell contains a focusable element or is itself focusable, regardless of whether the cell content is editable or interactive. There is one exception: if column or row header cells do not provide functions, such as sort or filter, they do not need to be focusable. One reason this is important is that screen readers need to be in their application reading mode, rather than their document reading mode, while the user is interacting with the grid. While in application reading mode, a screen reader user can only discover focusable elements and content that labels focusable elements. So, a screen reader user may unknowningly overlook elements contained in a grid that are either not focusable or not used to label a column or row. A more detailed description of this topic with examples is available in the section describing screen reader document and application reading modes.

Keyboard Interaction For Data Grids

The following keys provide grid navigation by moving focus among cells of the grid. These key commands are available by default after an element in the grid receives focus.

  • Right Arrow: Moves focus one cell to the right. If focus is on the right-most cell in the row, focus does not move.
  • Left Arrow: Moves focus one cell to the left. If focus is on the left-most cell in the row, focus does not move.
  • Down Arrow: Moves focus one cell down. If focus is on the bottom cell in the column, focus does not move.
  • Up Arrow: Moves focus one cell Up. If focus is on the top cell in the column, focus does not move.
  • Page Down: Moves focus down an author-determined number of rows, typically scrolling so the bottom row in the currently visible set of rows becomes one of the first visible rows. If focus is in the last row of the grid, focus does not move.
  • Page Up: Moves focus up an author-determined number of rows, typically scrolling so the top row in the currently visible set of rows becomes one of the last visible rows. If focus is in the first row of the grid, focus does not move.
  • Home: moves focus to the first cell in the row that contains focus.
  • End: moves focus to the last cell in the row that contains focus.
  • Control + Home: moves focus to the first cell in the first row.
  • Control + End: moves focus to the last cell in the last row.
  • When the above grid navigation keys move focus, whether the focus is set on an element inside the cell or the grid cell depends on cell content. See Whether to Focus on a Cell or an Element Inside It.
  • While navigation keys, such as arrow keys, are moving focus from cell to cell, they are not available to do something like operate a combobox or move an editing caret inside of a cell. If this functionality is needed, see Editing and Navigating Inside a Cell.
  • If navigation functions can dynamically add more rows or columns to the DOM, key events that move focus to the beginning or end of the grid, such as control + End, may move focus to the last row in the DOM rather than the last available row in the back-end data.

If a grid supports selection of cells, rows, or columns, the following keys are commonly used for these functions.

  • Control + Space: selects the column that contains the focus.
  • Shift + Space: Selects the row that contains the focus. If the grid includes a column with checkboxes for selecting rows, this key can serve as a shortcut for checking the box when focus is not on the checkbox.
  • Control + A: Selects all cells.
  • Shift + Right Arrow: Extends selection one cell to the right.
  • Shift + Left Arrow: Extends selection one cell to the left.
  • Shift + Down Arrow: Extends selection one cell down.
  • Shift + Up Arrow: Extends selection one cell Up.

See Global Recommendations for cut, copy and paste key assignments.

Layout Grids for Grouping Widgets

The grid pattern can be used to group a set of interactive elements, such as links, buttons, or checkboxes. Since only one element in the entire grid is included in the tab sequence, grouping with a grid can dramatically reduce the number of tab stops on a page. This is especially valuable if scrolling through a list of elements dynamically loads more of those elements from a large data set, such as in a continuous list of suggested products on a shopping site. If elements in a list like this were in the tab sequence, keyboard users are effectively trapped in the list. If any elements in the group also have associated elements that appear on hover, the grid pattern is also useful for providing keyboard access to those contextual elements of the user interface.

Unlike grids used to present data, A grid used for layout does not necessarily have header cells for labeling rows or columns and might contain only a single row or a single column. Even if it has multiple rows and columns, it may present a single, logically homogenous set of elements. For example, a list of recipients for a message may be a grid where each cell contains a link that represents a recipient. The grid may initially have a single row but then wrap into multiple rows as recipients are added. In such circumstances, grid navigation keys may also wrap so the user can read the list from beginning to end by pressing either Right Arrow or Down Arrow. While This type of focus movement wrapping can be very helpful in a layout grid, it would be disorienting if used in a data grid, especially for users of assistive technologies.

Because arrow keys are used to move focus inside of a grid, a grid is both easier to build and use if the components it contains do not require the arrow keys to operate. If a cell contains an element like a listbox, then an extra key command to focus and activate the listbox is needed as well as a command for restoring the grid navigation functionality. Aproaches to supporting this need are described in the section on Editing and Navigating Inside a Cell.

Keyboard Interaction For Layout Grids

The following keys provide grid navigation by moving focus among cells of the grid. These key commands are available by default after an element in the grid receives focus.

  • Right Arrow: Moves focus one cell to the right. Optionally, if focus is on the right-most cell in the row, focus may move to the first cell in the following row. If focus is on the last cell in the grid, focus does not move.
  • Left Arrow: Moves focus one cell to the left. Optionally, if focus is on the left-most cell in the row, focus may move to the last cell in the previous row. If focus is on the first cell in the grid, focus does not move.
  • Down Arrow: Moves focus one cell down. Optionally, if focus is on the bottom cell in the column, focus may move to the top cell in the following column. If focus is on the last cell in the grid, focus does not move.
  • Up Arrow: Moves focus one cell up. Optionally, if focus is on the top cell in the column, focus may move to the bottom cell in the previous column. If focus is on the first cell in the grid, focus does not move.
  • Page Down (Optional): Moves focus down an author-determined number of rows, typically scrolling so the bottom row in the currently visible set of rows becomes one of the first visible rows. If focus is in the last row of the grid, focus does not move.
  • Page Up (Optional): Moves focus up an author-determined number of rows, typically scrolling so the top row in the currently visible set of rows becomes one of the last visible rows. If focus is in the first row of the grid, focus does not move.
  • Home: moves focus to the first cell in the row that contains focus. Optionally, if the grid has a single column or fewer than three cells per row, focus may instead move to the first cell in the grid.
  • End: moves focus to the last cell in the row that contains focus. Optionally, if the grid has a single column or fewer than three cells per row, focus may instead move to the last cell in the grid.
  • Control + Home (optional): moves focus to the first cell in the first row.
  • Control + End (Optional): moves focus to the last cell in the last row.
  • When the above grid navigation keys move focus, whether the focus is sett on an element inside the cell or the grid cell depends on cell content. See Whether to Focus on a Cell or an Element Inside It.
  • While navigation keys, such as arrow keys, are moving focus from cell to cell, they are not available to do something like operate a combobox or move an editing caret inside of a cell. If this functionality is needed, see Editing and Navigating Inside a Cell.
  • If navigation functions can dynamically add more rows or columns to the DOM, key events that move focus to the beginning or end of the grid, such as control + End, may move focus to the last row in the DOM rather than the last available row in the back-end data.

It would be unusual for a layout grid to provide functions that require cell selection. If it did, though, the following keys are commonly used for these functions.

  • Control + Space: selects the column that contains the focus.
  • Shift + Space: Selects the row that contains the focus. If the grid includes a column with checkboxes for selecting rows, this key can serve as a shortcut for checking the box when focus is not on the checkbox.
  • Control + A: Selects all cells.
  • Shift + Right Arrow: Extends selection one cell to the right.
  • Shift + Left Arrow: Extends selection one cell to the left.
  • Shift + Down Arrow: Extends selection one cell down.
  • Shift + Up Arrow: Extends selection one cell Up.

See Global Recommendations for cut, copy and paste key assignments.

Keyboard Interaction - Setting Focus and Navigating Inside Cells

This section describes two important aspects of keyboard interaction design shared by both data and layout grid patterns:

  1. Choosing whether a cell or an element inside a cell receives focus in response to grid navigation key events.
  2. Enabling grid navigation keys to be used to interact with elements inside of a cell.
Whether to Focus on a Cell Or an Element Inside IT

For assistive technology users, the quality of experience when navigating a grid heavily depends on both what a cell contains and on where keyboard focus is set. For example, if a cell contains a button and a grid navigation key places focus on the cell instead of the button, screen readers announce the button label but do not tell users a button is present.

There are two optimal cell design and focus behavior combinations:

  1. A cell contains one widget whose operation does not require arrow keys and grid navigation keys set focus on that widget. Examples of such widgets include link, button, menubutton, toggle button, radio button (not radio group), switch, and checkbox.
  2. A cell contains text or a single graphic and grid navigation keys set focus on the cell.

While any combination of widgets, text, and graphics may be included in a single cell, grids that do not follow one of these two cell design and focus movement patterns add complexity for authors or users or both. The reference implementations included in the example section below demonstrate some strategies for making other cell designs as accessible as possible, but the most widely accessible experiences are likely to come by applying the above two patterns.

Editing and Navigating Inside a Cell

While navigation keys, such as arrow keys, are moving focus from cell to cell, they are not available to perform actions like operate a combobox or move an editing caret inside of a cell. The user may need keys that are used for grid navigation to operate elements inside a cell if a cell contains:

  1. Editable content.
  2. Multiple widgets.
  3. A widget that utilizes arrow keys in its interaction model, such as a radio group or slider.

Following are common keyboard conventions for disabling and restoring grid navigation functions.

  • Enter: Disables grid navigation and:
    • If the cell contains editable content, places focus in an input field, such as a textbox. If the input is a single-line text field, a subsequent press of Enter may either restore grid navigation functions or move focus to an input field in a neighboring cell.
    • If the cell contains one or more widgets, places focus on the first widget.
  • F2:
    • If the cell contains editable content, places focus in an input field, such as a textbox. A subsequent press of F2 restores grid navigation functions.
    • If the cell contains one or more widgets, places focus on the first widget. A subsequent press of F2 restores grid navigation functions.
  • Alphanumeric keys: If the cell contains editable content, places focus in an input field, such as a textbox.

When grid navigation is disabled, conventional changes to navigation behaviors include:

  • Escape: restores grid navigation. If content was being edited, it may also undo edits.
  • Right Arrow or Down Arrow: If the cell contains multiple widgets, moves focus to the next widget inside the cell, optionally wrapping to the first widget if focus is on the last widget. Otherwise, passes the key event to the focused widget.
  • Left Arrow or Up Arrow: If the cell contains multiple widgets, moves focus to the previous widget inside the cell, optionally wrapping to the first widget if focus is on the last widget. Otherwise, passes the key event to the focused widget.
  • Tab: moves focus to the next widget in the grid. Optionally, the focus movement may wrap inside a single cell or within the grid itself.
  • Shift + Tab: moves focus to the previous widget in the grid. Optionally, the focus movement may wrap inside a single cell or within the grid itself.

WAI-ARIA Roles, States, and Properties

  • The grid container has role grid.
  • Each row container has role row and is either a DOM descendant of or owned by the grid element or an element with role rowgroup.
  • Each cell is either a DOM descendant of or owned by a row element and has one of the following roles:
    • columnheader if the cell contains a title or header information for the column.
    • rowheader if the cell contains title or header information for the row.
    • gridcell if the cell does not contain column or row header information.
  • If there is an element in the user interface that serves as a label for the grid, aria-labelledby is set on the grid element with a value that refers to the labeling element. Otherwise, a label is specified for the grid element using aria-label.
  • If the grid has a caption or description, aria-describedby is set on the grid element with a value refering to the element containing the description.
  • If the grid provides sort functions, aria-sort is set to an appropriate value on the header cell element for the sorted column or row as described in the section on grid and table properties.
  • If the grid supports selection, when a cell or row is selected, the selected element has aria-selected set true.
  • If the grid provides content editing functionality and contains cells that may have edit capabilities disabled in certain conditions, aria-readonly may be set true on cells where editing is disabled. If edit functions are disabled for all cells, aria-readonly may be set true on the grid element. Grids that do not provide editing functions do not include the aria-readonly attribute on any of their elements.
  • If there are conditions where some rows or columns are hidden or not present in the DOM, e.g., data is dynamically loaded when scrolling or the grid provides functions for hiding rows or columns, the following properties are applied as described in the section on grid and table properties.
  • If the grid includes cells that span multiple rows or multiple columns, and if the grid role is NOT applied to an HTML table element, then aria-rowspan or aria-colspan is applied as described in grid and table properties.
  • If the element with the grid role is an HTML table element, then it is not necessary to use ARIA roles for rows and cells because the HTML elements have implied ARIA semantics. For example, an HTML <TR> has an implied ARIA role of row. A grid built from an HTML table that includes cells that span multiple rows or columns must use HTML rowspan and colspan and must not use aria-rowspan or aria-colspan.
  • If rows or cells are included in a grid via aria-owns, they will be presented to assistive technologies after the DOM descendants of the grid element unless the DOM descendants are also included in the aria-owns attribute. See using aria-owns for a detailed explaination.

Examples

  • Data Grids: Three example implementations of grid that include features relevant to presenting tabular information, such as content editing, sort, and column hiding.
  • Layout Grids: Three example implementations of grids that are used to lay out widgets, including a collection of navigation links, a message recipients list, and a set of search results.

Listbox

A listbox widget allows a user to select one or more items from a list of options. A listbox that allows a single option to be chosen is a single-select listbox; one that allows multiple options to be selected is a multi-select listbox.

The contents of option elements in a listbox are reduced by browsers to static text strings that become the accessible names of the options. So, options in a listbox should not contain interactive elements, such as links, buttons, or checkboxes. To create a list of interactive elements, see the grid pattern.

Authors should avoid creating options with very long names. Each option name is spoken by a screen reader as a single unit of speech when the user navigates the list. When a large amount information is spoken as the result of a single key press, it can be difficult to understand. If the speaking of an option is interrupted, the user will typically have to re-read the entire option. And, if the user does not understand what is spoken, re-reading of a listbox option name by character, word, or phrase may be a difficult operation for some screen reader users because the screen reader is in an interactive mode, rather than a reading mode, when operating a widget like a listbox.

Authors should also avoid creating sets of options where each option name starts with the same word or phrase. Otherwise, scrolling through the list to find a specific option becomes inordinately time consuming for a screen reader user who must listen to that word or phrase repeated before hearing what is unique about each option. For example, if a listbox for choosing a city were to contain options where each city name were preceded by a country name, and if many cities were listed for each country, a screen reader user would have to listen to the country name before hearing each city name. In such a scenario, it would be better to have 2 list boxes, one for country and one for city.

Keyboard Interaction

  • When a single-select listbox receives focus:
    • If none of the options are selected before the listbox receives focus, the first option receives focus. The author may choose to have the first option automatically selected.
    • If an option is selected before the listbox receives focus, focus is set on the selected option.
  • When a multi-select listbox receives focus:
    • If none of the options are selected before the listbox receives focus, focus is set on the first option. The option should not be selected when it receives focus.
    • If one or more options are selected before the listbox receives focus, focus is set on the first option in the list that is selected.
  • Up Arrow and Down Arrow: Move focus to the previous and next option, respectively. If it is a single-select listbox, the selection state moves with the focus.
  • Home and End (Optional): Move focus to first and last option, respectively. If it is a single-select listbox, the selection state moves with the focus. Strongly recommended for lists with more than five options.
  • Type-ahead is strongly recommended for all lists, but essential for long lists (typically more than five options):
    • Type a character: focus moves to the next item with a name that starts with the typed character.
    • Type multiple characters in rapid succession: focus moves to the next item with a name that starts with the string of characters typed.
  • Multiple Selection: Authors may implement either of two interaction models to support multiple selection: a recommended model that does not require the user to hold a modifier key, such as Shift or Control, while navigating the list or an alternative model that does require modifier keys to be held while navigating in order to avoid losing selection states.
    • Recommended selection model -- holding modifier keys is not necessary:
      • Space: changes the selection state of the focused option .
      • Shift + Up Arrow and Shift + Down Arrow (optional): move focus to and select the previous and next option, respectively.
      • Shift + Space (Optional): selects contiguous items from the last selected item to the current item.
      • Control + Shift + Home (Optional): selects the option with focus and all options up to the beginning of the list.
      • Control + Shift + End (Optional): selects the option with focus and all options down to the end of the list.
      • Control + A (Optional): selects all options in the list.
    • Alternative selection model -- modifier keys must be held down to maintain selected states when navigating):
      • Shift + Up Arrow and Shift + Down Arrow: move focus to and select the previous and next option, respectively.
      • Control + Up Arrow and Control + Down Arrow: Without changing the selection state, move focus to the previous and next option, respectively.
      • Control + Space Changes the selection state of the focused option.
      • Up Arrow and Down Arrow: Remove all selected states and move focus to the previous and next option, respectively.
      • Home and End (Optional): Remove all selected states and move focus to the first and last option, respectively.
      • Shift + Space (Optional): selects contiguous items from the last selected item to the current item.
      • Control + Shift + Home (Optional): selects the option with focus and all options up to the beginning of the list.
      • Control + Shift + End (Optional): selects the option with focus and all options down to the end of the list.
      • Control + A (Optional): selects all options in the list.
  1. If the ability to select or deselect all options may be commonly needed, it is recommended that the author add separate controls to perform these actions.
  2. Focus (the active element) is different from the selected state. See to be written.
  3. The listbox role supports the aria-activedescendant property, which provides an alternative to moving DOM focus among options when scrolling. For details, see to be written.

WAI-ARIA Roles, States, and Properties

  • An element that contains or owns all the listbox options has role listbox.
  • Each option in the listbox has role option and is a DOM descendant of the element with role listbox or is referenced by an aria-owns property on the listbox element.
  • If the listbox is not part of another widget, then it has a visible label referenced by aria-labelledby on the element with role listbox.
  • The selected option has aria-selected set to true.
  • if the listbox supports multiple selection:
  • If the complete set of available options is not present in the DOM due to dynamic loading as the user scrolls, their aria-setsize and aria-posinset attributes are set appropriately.

Example

Add link to example

Radio Group

A radio group is a set of checkable buttons, known as radio buttons, where only one button in the set may be in a checked state.

Keyboard Interaction

  • When a radio group is receiving focus:
    • Tab and Shift+Tab: move focus to the checked radio button. If none of the radio buttons are checked, they move focus to the first radio button in the group.
  • When focus is on a radio button in a radio group:
    • Tab: moves focus to the element in the page tab sequence that follows the radio group.
    • Shift+Tab: moves focus to the element in the page tab sequence that precedes the radio group.
    • Space: checks the focussed radio button if it is not already checked.
    • Right Arrow and Down Arrow: move focus to the next radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the last button, focus moves to the first button.
    • Left Arrow and Up Arrow: move focus to the previous radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the first button, focus moves to the last button.

The behavior of the Tab key described above differs slightly from the behavior provided by some browsers for native HTML radio groups. In some browsers, if none of the radio buttons are selected, Shift+Tab places focus on the last radio button instead of the first radio button.

WAI-ARIA Roles, States, and Properties

  • The radio buttons are contained in or owned by an element with role radiogroup .
  • Each radio button element has role radio.
  • If a radio button is checked, the radio element has aria-checked set to true. If it is not checked, it has aria-checked set to false.
  • Each radio element is labeled by its content, has a visible label referenced by aria-labelledby, or has a label specified with aria-label.
  • The radiogroup element has a visible label referenced by aria-labelledby or has a label specified with aria-label.
  • If elements providing additional information about either the radio group or each radio button are present, those elements are referenced by the radiogroup element or radio elements with the aria-describedby property.

Example

Radio Group Examples

Slider

A slider is an input where the user selects a value from within a given range. Sliders typically have a slider thumb that when moved will change the current value within the bar or track.

Keyboard Interaction

  • Right Arrow and Up Arrow: Increase the value of the slider.
  • Left Arrow and Down Arrow: Decrease the value of the slider.
  • Home and End: Set the slider to the first and last values of the slider.
  • Tab: Moves focus into and out of the slider.
  • Page Up and Page Down (Optional): Increment or decrement the slider by an amount larger than the step changes made by the arrow keys.
  1. Focus is placed on the slider (the visual object that the mouse user would move, also known as the thumb)
  2. In some circumstances, an author may reverse the direction of the value change for the keys specified above, e.g., make Up Arrow decrease the value, if the author is certain doing so will result in a better user experience.

WAI-ARIA Roles, States, and Properties

  • The slider control has the role slider.
  • Sliders require the aria-valuemin, aria-valuemax, and aria-valuenow properties representing the minimum possible value of the slider, the maximum possible value, and the current value. All of these are decimal numbers. The minimum and maximum are typically fixed and do not change.
  • Sometimes the value is not user readable, such as a number for the day of the week, e.g., "1". In those cases, use the aria-valuetext property to provide a human readable string for the slider's value, e.g. "Monday".
  • It is recommended that authors provide a visible label for the slider, referencing it using aria-labelledby.
  • If the slider is vertical specify aria-orientation="vertical"

Example

Slider (Multi-Thumb)

A multi-thumb slider is a slider with multiple slider thumbs designed to change 2 or more different values for an object it controls. In most cases the user is selecting a maximum and minimum value to create a range, but in some cases the 2 (or more) values selected are completely independent.

Keyboard Interaction

This range slider allows author to modify multiple values for an object.

  • Tab to the first slider thumb.
  • Second Tab moves to next slider thumb..
  • Third Tab moves to the next slider thumb or if there are no more, it moves to the next tab stop on the page.
  • Shift + Tab moves backwards through the tabs.
  • With focus on a thumb: Same as Slider above.
    • Right Arrow and Up Arrow increase the value of the slider. If applicable this is constrained by the value of the other thumb.
    • Left Arrow and Down Arrow decrease the value of the slider. If applicable this is constrained by the value of the other thumb.
    • Home and End move to the first and last values of the slider. If applicable this is constrained by the value of the other thumb.
    • Page Up and Page Down optionally increment or decrement the slider by a given amount. If applicable this is constrained by the value of the other thumb.
  1. Focus is placed on one of the thumbs of the slider.
  2. All thumbs are in the tab order.
  3. If the current value of a slider crosses over one of the other sliders, the tab order remains the same. Example. If a high range slider is moved so that its current value is below the current value of a low range slider, the thumb will visually appear to be before the low range slider. This should not change the tab order of the slider.
  4. In some circumstances, an author may reverse the direction of the value change for the keys specified above, e.g., make Up Arrow decrease the value, if the author is certain doing so will result in a better user experience.

WAI-ARIA Roles, States, and Properties

  • Each slider control has the role slider.
  • Each slider requires the aria-valuemin, aria-valuemax, and aria-valuenow properties representing the minimum possible value of the slider, the maximum possible value, and the current value. All of these are decimal numbers. The maximum of the lower slider limits the minimum of the upper slider and vice versa.
  • Sometimes the value is not user readable, such as a number for the day of the week, e.g., "1". In those cases, use the aria-valuetext property to provide a human readable string for the slider's value, e.g. "Monday".
  • It is recommended that authors provide a visible label for the multi-thumb slider, referencing it using aria-labelledby.

Example

Any examples referenced here that are hosted outside www.w3.org may have changed and may not accurately exemplify the guidance in this section. The APG task force is developing examples for APG version 1.1 that will be directly incorporated into the guide.

Spinbutton

A widget that allows users to choose a value from a set, or range, of discrete values. For example, select a number from 1 to 59 for the minute of an hour when setting an alarm.

A spin button provides ways to easily increment and decrement the value. If the range is large, it may support changing the value by both a single step and by multiple steps at once. For instance, in the alarm example, the user may be able to move by 1 minute with the arrow keys and by 10 minutes with PageUp and PageDown.

A spinbutton usually includes a text field that displays the current value and allows users to directly edit it.

Keyboard Interaction

The associated text field generally supports standard text entry operations such as selection of characters, deletions, insertions, and caret movement using the Right Arrow and Left Arrow keys. The exception is when the spinbutton's value space is restricted and the associated script limits the characters. For example, an hour-and-minute spinner would allow only the digits 1-59, the colon ':', and the characters 'AM' and 'PM'. If the user typed any other character, it would not change the contents of the text field nor the value of the spinbutton.

  • Up Arrow increases the value.
  • Down Arrow decreases the value.
  • Home and End key move to the maximum or minimum values.
  • Optional: Page Up and Page Down increase or decrease the value in larger steps.
  • Tab key moves into and out of the widget.

Focus should remain on the edit field

WAI-ARIA Roles, States, and Properties

  • The widget has the role spinbutton.
  • Spinbuttons support the aria-valuemin, aria-valuemax, and aria-valuenow properties representing the minimum possible value of the spinner, the maximum possible value, and the current value. All of these are decimal numbers. The minimum and maximum are typically fixed.
  • Sometimes the value is not user readable, such as a number for the day of the week, e.g., "1". In those cases, use the aria-valuetext property to provide a human readable string for the slider's value, e.g. "Monday".

Example

Any examples referenced here that are hosted outside www.w3.org may have changed and may not accurately exemplify the guidance in this section. The APG task force is developing examples for APG version 1.1 that will be directly incorporated into the guide.

Table

Drafting this section is issue 90.

[Place holder for a to-be-written section about data tables] While writing the grid pattern, the topic of data tables came up because the grid pattern has text clarifying when to use grid verses when to use table. There was a suggestion to cover tables at the same time in the grid section. That made the grid pattern section feel overwhelming so adding a placeholder for a potential table section here. The grid pattern links to this section.

Tabs

Tabs are a set of layered sections of content, known as tab panels, that display one panel of content at a time. Each tab panel has an associated tab element, that when activated, displays the panel. The list of tab elements is arranged along one edge of the currently displayed panel, most commonly the top edge.

Terms used to describe this design pattern include:

Tabs or Tabbed Interface
A set of tab elements and their associated tab panels.
Tab List
A set of tab elements contained in a tablist element.
tab
An element in the tab list that serves as a label for one of the tab panels and can be activated to display that panel.
tabpanel
The element that contains the content associated with a tab.

When a tabbed interface is initialized, one tab panel is displayed and its associated tab is styled to indicate that it is active. When the user activates one of the other tab elements, the previously displayed tab panel is hidden, the tab panel associated with the activated tab becomes visible, and the tab is considered "active".

Keyboard Interaction

For the tab list:

  • Tab: When the tab list is receiving focus, places focus on the active tab element . When the tab list contains the focus, moves focus to the next element in the page tab sequence outside the tablist, which is typically either the first focusable element inside the tab panel or the tab panel itself.
  • When focus is on a tab element in a horizontal tab list:
    • Left Arrow: moves focus to the previous tab. If focus is on the first tab, moves focus to the last tab. Optionally, activates the newly focused tab (See note below).
    • Right Arrow: Moves focus to the next tab. If focus is on the last tab element, moves focus to the first tab. Optionally, activates the newly focused tab (See note below).
  • When focus is on a tab in a tablist with either horizontal or vertical orientation:
    • Space or Enter: Activates the tab if it was not activated automatically on focus.
    • Home (Optional): Moves focus to the first tab
    • End (Optional): Moves focus to the last tab.
    • Shift + F10: If the tab has an associated pop-up menu, opens the menu.
    • Delete (Optional): If deletion is allowed, deletes (closes) the current tab element and its associated tab panel. If any tabs remain, sets focus to the tab following the tab that was closed and activates the newly focused tab. Alternatively, or in addition, the delete function is available in a context menu.
  1. It is recommended that tabs activate automatically when they receive focus as long as their associated tab panels are displayed without noticeable latency. This typically requires tab panel content to be preloaded. Otherwise, automatic activation slows focus movement, which significantly hampers users' ability to navigate efficiently across the tab list.
  2. If the tabs in a tab list are arranged vertically:
    1. Down Arrow performs as Right Arrow is described above.
    2. Up Arrow performs as Left Arrow is described above.
  3. If the tab list is horizontal, it does not listen for Down Arrow or Up Arrow so those keys can provide their normal browser scrolling functions even when focus is inside the tab list.

WAI-ARIA Roles, States, and Properties

  • The element that serves as the container for the set of tabs has role tablist.
  • Each element that serves as a tab has role tab and is contained within the element with role tablist.
  • Each element that contains the content panel for a tab has role tabpanel.
  • Each element with role tab has the property aria-controls referring to its associated tabpanel element.
  • The active tab element has the state aria-selected set to true and all other tab elements have it set to false.
  • Each element with role tabpanel has the property aria-labelledby referring to its associated tab element.
  • If a tab element has a pop-up menu, it has the property aria-haspopup set to true.
  • If the tablist element is vertically oriented, it has the property aria-orientation set to vertical. The default value of aria-orientation for a tablist element is horizontal.

Example

Toolbar

A toolbar is a container for grouping a set of controls, such as buttons, menubuttons, or checkboxes.

When a set of controls is visually presented as a group, the toolbar role can be used to communicate the presence and purpose of the grouping to screen reader users. Grouping controls into toolbars can also be an effective way of reducing the number of tab stops in the keyboard interface.

When designing and implementing toolbars, it is strongly recommended that authors:

  1. Implement focus management so there is one stop in the keyboard tab sequence for the toolbar and arrow keys move focus among the contained controls.
  2. Avoid including controls that require arrow keys to operate, such as textbox or radio group. If unavoidable, include only one such control and make it the last element .
  3. Use toolbar as a grouping element only if the group contains 3 or more controls.

Keyboard Interaction

  • Tab: Moves focus into and out of the toolbar. When focus moves into the toolbar, the first enabled control receives focus. Optionally, if the toolbar has previously contained focus, the control that last had focus may receive focus.
  • For a horizontal toolbar (the default):
    • Left Arrow: Moves focus to the previous control. Optionally, focus movement may wrap from the first element to the last element.
    • Right Arrow: Moves focus to the next control. Optionally, focus movement may wrap from the last element to the first element.
  1. If the items in a toolbar are arranged vertically:
    1. Down Arrow performs as Right Arrow is described above.
    2. Up Arrow performs as Left Arrow is described above.
  2. Typically, disabled elements are not focusable when navigating with a keyboard. However, in circumstances where discoverability of a function is crucial, authors may choose to make disabled controls focusable so screen reader users are more likely to be aware of their presence.
  3. In applications where quick access to a toolbar is important, such as accessing an editor's toolbar from its text area, it is recommended that authors provide a documented shortcut key for moving focus from the relevant context to its corresponding toolbar.

WAI-ARIA Roles, States, and Properties

  • The element has the role toolbar.
  • Labeling with aria-label is recommended, especially if the user interface includes multiple toolbars.
  • If the controls are arranged vertically, the toolbar element has aria-orientation set to vertical. The default orientation is horizontal.

Example

Any examples referenced here that are hosted outside www.w3.org may have changed and may not accurately exemplify the guidance in this section. The APG task force is developing examples for APG version 1.1 that will be directly incorporated into the guide.

Tooltip Widget

Popup that displays a description for an element when a user hovers over or focuses on that element. It should popup automatically when the user gives input focus to the widget or element with which it is associated. The tooltip widget can be dismissed by pressing the Escape key or by other methods noted below. The tooltip widget differs from the Dialog (Tooltip) in that it does not receive focus at any time.

The tooltip may appear immediately or there may be a small delay before the tooltip appears.

Keyboard Interaction

Escape: Dismisses the Tooltip.

  1. The trigger element to which the tooltip is attached, e.g., a link, should never actually lose input focus.
  2. If the tooltip is invoked when the trigger element gets focus, then it should be dismissed when it no longer has focus (onBlur). If the tooltip is invoked with mouseIn, then it should be dismissed with a mouseOut.
  3. If nested widgets use the same keys, e.g., Escape, then they should be handled in a Last In First Out (LIFO) manner. For example, an editable grid contains gridcells which contain date fields. The user invokes Actionable mode on the grid and then interacts with the Date Field to invoke the Date Picker. At this point the first press of the Escape key will close the Date Picker, the second press will exit Actionable mode and return to Navigation mode.

WAI-ARIA Roles, States, and Properties

  • Uses the WAI-ARIA role tooltip.
  • The element that the tooltip is for references the tooltip using aria-describedby.

Example

Any examples referenced here that are hosted outside www.w3.org may have changed and may not accurately exemplify the guidance in this section. The APG task force is developing examples for APG version 1.1 that will be directly incorporated into the guide.

Tree View

A tree view is a component to navigate hierarchical lists. It is made up of one or more top level nodes. A node may have children or it may be an end node. Nodes with children can be expanded or collapsed - when expanded its child nodes are visible. When collapsed the children are not visible. There is generally some sort of visual indication whether a node has children and can be expanded. Any number of nodes can be expanded at a time and child nodes may contain children.

An example of a Tree View is a File Navigator where a tree view is used to navigate the directories and files on a file system. The directory nodes can be expanded and collapsed to reveal its contained subdirectories and files. Terms for understanding tree views include:

node
An item in a tree.
parent node
Node with children. It can be opened / expanded or closed / collapsed
open node
Expanded node with children; first-level children are visible.
closed node
Closed node with children; the children are not visible.
end node
Node with no children

Nodes can be focused and/or selected. There must be visual distinction between focused and selected nodes.

Keyboard Interaction

  • On first load of the tree component, the top level node is in the tab order.
  • One and only one node of the tree component is in the tab order of the page at any time.
  • The last visited node in the tree control is retained in the tab order when the user navigates away from the tree control.
  • Arrowing to an item with the keyboard will focus and select the node. Any previous selections are cleared
  • Up Arrow and Down arrow keys move between visible nodes.
  • Left arrow key on an expanded node closes the node.
  • Left arrow key on a closed or end node moves focus to the node's parent.
  • Right arrow key expands a closed node, moves to the first child of an open node, or does nothing on an end node.
  • Enter key performs the default action on end nodes.
  • Typing a letter key moves focus to the next instance of a visible node whose title begins with that letter.
  • Home key moves to the top node in the tree view.
  • End key moves to the last visible node in the tree view.
  • Control + Arrow to an item with the keyboard focuses the item (but does not select it). Previous selections are maintained, provided that the Control key is not released or that some other keyboard function is not performed.
  • Control + Space with focus on an item toggles the selection of the item.
  • Shift + Up Arrow extends selection up one node.
  • Shift + Down Arrow extends selection down one node.
  • Shift + Home extends selection up to the top-most node.
  • Shift + End extends selection down to the last node.
  • *(asterisk) - on numeric keypad (optional) expands all siblings at the current node's level.

WAI-ARIA Roles, States, and Properties

  • The tree view container has a role of tree.
  • Each node in a tree has the role treeitem and should be a DOM child of tree.
  • If is not a DOM child of tree, then it should be referenced by aria-owns from its logical parent node.
  • If all nodes in the tree are not DOM children of the tree, then set their aria-level, aria-setsize and aria-posinset accordingly; otherwise, this information cannot be computed for context by the user agent.
  • A collection of treeitems to be expanded and collapsed are enclosed in a group.
  • Each tree node which can be expanded should have aria-expanded set to false
  • Each tree node which is expanded should have aria-expanded set to true
  • Leaf nodes should not have aria-expanded set
  • If aria-multiselectable is set to true on the tree, then each selectable tree node should have aria-selected set to either true or false depending on the current selection.

Examples

Example ID Action aria-owns aria-level aria-setsize/
aria-posinset
Description
Treeview 1a Select a file - Computed Computed
  • Expects browser to compute values for aria-level, aria-posinset and aria-setsize based on DOM structure.
Treeview 1b Select a file - Markup Markup
  • Explicitly defines values of aria-level, aria-posinset and aria-setsize
Treeview 2a Follow a link - Computed Computed
  • Expects browser to compute values for aria-level, aria-posinset and aria-setsize based on DOM structure.
Treeview 2b Follow a link - Markup Markup
  • Explicitly defines values of aria-level, aria-posinset and aria-setsize

Window Splitter

Visible separator between sections of a Window that is used to modify the size of the panes.

A Window Splitter can take one of two forms -- fixed size and variable size.

Keyboard Interaction

  • Tab: Moves focus in to and out of the splitter.
  • Left Arrow and Right Arrow: Move a vertical splitter left and right.
  • Up Arrow and Down Arrow: Move a horizontal splitter up and down.
  • Enter: If pane controlled by the splitter is not collapsed, then collapse the pane. If the pane is collapsed then restore the splitter to its previous position.
  • End (Optional): moves splitter so the associated pane is the largest allowed size.
  • Home (Optional): Moves splitter so the associated pane is the smallest allowed size. This may collapse the pane completely.
  • F6 (Optional): Cycle through the window panes.

A fixed size splitter simply omits implementation of the arrow keys.

WAI-ARIA Roles, States, and Properties

  • The splitter has role separator.
  • If the splitter is expandable and collapsible, keep the splitter's aria-expanded state updated accordingly.
  • Label the splitter with aria-label, aria-labelledby, or the title attribute.
  • Set the aria-controls attribute of the element with role separator role to the IDs of the panes whose sizes it controls.

Example

Any examples referenced here that are hosted outside www.w3.org may have changed and may not accurately exemplify the guidance in this section. The APG task force is developing examples for APG version 1.1 that will be directly incorporated into the guide.

Landmark Roles Design Patterns

Landmarks provide a powerful way to identify the organization and structure of a web page. The structural information conveyed visually to users should be represented programmatically in the markup using landmark roles. The use of landmark roles supports keyboard navigation to the structure of a web page for screen reader users, and can be used as targets for author supplied "skip links" and browser extensions for enhanced keyboard navigation.

This section is intended to assist designers, developers and quality assurance staff in defining and understanding the importance of logical, usable, and accessible layout for assistive technologies using HTML5 sectioning elements and ARIA landmark roles.

HTML5 Sectioning Elements

It is important to understand that many HTML5 sectioning elements by default define ARIA landmarks. If HTML5 sectioning elements are used without understanding the associated landmark structure, assistive technology users will most likely be confused and less efficient in accessing content and interacting with web pages. More information on HTML5 element role mapping.

Default landmark roles for HTML5 sectioning elements
HTML5 Element Default Landmark Role
aside complementary
footer contentinfo when in context of the body element
header banner when in context of the body element
main main
nav navigation
section region when it has an accessible name using aria-labelledby or aria-label

General Principles of Landmark Design

Due to the complexity of todays web content, if using landmarks, all content should reside in a semantically meaningful landmark in order that content is not missed by the user.

Step 1: Identify the logical structure

Step 2: Assign landmark roles to each area

Step 3: Label areas

Landmark Roles

Banner

A banner landmark identifies site-oriented content at the beginning of each page within a website. Site-oriented content typically includes things such as the logo or identity of the site sponsor, and site-specific search tool. A banner usually appears at the top of the page and typically spans the full width.

  • Each page may have one banner landmark.
  • The banner landmark should be a top-level landmark.
  • When a page contains nested document and/or application roles (e.g. typically through the use of iframe and frame elements), each document or application role may have one banner landmark.
  • If a page includes more than one banner landmark, each should have a unique label (see Step 3 above).
HTML5 Techniques
  • The HTML5 header element defines a banner landmark when its context is the body element.
  • The HTML5 header element is not considered a banner landmark when it is descendant of any of following elements (see HTML Accessibility Mappings):
    • article
    • aside
    • main
    • nav
    • section
ARIA Techniques

If the HTML5 header element technique is not being used, a role="banner" attribute should be used to define a banner landmark.

Examples

Banner Landmark Example

Complementary

A complementary landmark is a supporting section of the document, designed to be complementary to the main content at a similar level in the DOM hierarchy, but remains meaningful when separated from the main content.

  • complementary landmarks should be top level landmarks (e.g. not contained within any other landmarks).
  • If the complementary content is not related to the main content, a more general role should be assigned (e.g. region).
  • If a page includes more than one complementary landmark, each should have a unique label (see Step 3 above).
HTML5 Technique

Use the HTML5 aside element to define a complementary landmark.

ARIA Technique

If the HTML5 aside element technique is not being used, use a role="complementary" attribute to define a complementary landmark.

Examples

Complementary Landmark Example

Contentinfo

A contentinfo landmark is a way to identify common information at the bottom of each page within a website, typically called the "footer" of the page, including information such as copyrights and links to privacy and accessibility statements.

  • Each page may have one contentinfo landmark.
  • The contentinfo landmark should be a top-level landmark.
  • When a page contains nested document and/or application roles (e.g. typically through the use of iframe and frame elements), each document or application role may have one contentinfo landmark.
  • If a page includes more than one contentinfo landmark, each should have a unique label (see Step 3 above).
HTML5 Techniques
  • The HTML5 footer element defines a contentinfo landmark when its context is the body element.
  • The HTML5 footer element is not considered a contentinfo landmark when it is descendant of any of following elements (see HTML Accessibility Mappings):
    • article
    • aside
    • main
    • nav
    • section
ARIA Technique

If the HTML5 footer element technique is not being used, a role="contentinfo" attribute should be used to define a contentinfo landmark.

Examples

Contentinfo Landmark Example

Form

A form landmark identifies a region that contains a collection of items and objects that, as a whole, combine to create a form when no other named landmark is appropriate (e.g. main or search).

  • Use the search landmark instead of the form landmark when the form is used for search functionality.
  • A form landmark should have a label to help users understand the purpose of the form.
  • A label for the form landmark should be visible to all users (e.g. an h1-h6 element).
  • If a page includes more than one form landmark, each should have a unique label (see Step 3 above).
  • Whenever possible, controls contained in a form landmark in an HTML document should use native host semantics:
    • button
    • input
    • select
    • textarea
HTML5 Techniques

The HTML5 form element that defines a form landmark when it has an accessible name (e.g. aria-labelledby, aria-label or title).

ARIA Technique

Use the role="form" to identify a region of the page; do not use it to identify every form field.

Examples

Form Landmark Example

Main

A main landmark identifies the primary content of the page.

  • Each page should have one main landmark.
  • The main landmark should be a top-level landmark.
  • When a page contains nested document and/or application roles (e.g. typically through the use of iframe and frame elements), each document or application role may have one main landmark.
  • If a page includes more than one main landmark, each should have a unique label (see Step 3 above).
HTML5 Technique

Use the HTML5 main element to define a main landmark.

ARIA Technique

If the HTML5 main element technique is not being used, use a role="main" attribute to define a main landmark.

Examples

Main Landmark Example

Navigation

Navigation landmarks provide a way to identify groups (e.g. lists) of links that are intended to be used for website or page content navigation.

  • If a page includes more than one navigation landmark, each should have a unique label (see Step 3 above).
  • If a navigation landmark has an identical set of links as another navigation landmark on the page, use the same label for each navigation landmark.
HTML5 Technique

Use the HTML5 nav element to define a navigation landmark.

ARIA Technique

If the HTML5 nav element technique is not being used, use a role="navigation" attribute to define a navigation landmark.

Examples

Navigation Landmark Example

Region

A region landmark is a perceivable section of the page containing content that is sufficiently important for users to be able to navigate to the section.

  • A region landmark must have a label.
  • If a page includes more than one region landmark, each should have a unique label (see Step 3 above).
  • The region landmark can be used identify content that named landmarks do not appropriately describe.
HTML5 Technique

Use the HTML5 section element to define a region landmark.

ARIA Technique

If the HTML5 section element technique is not being used, use a role="region" attribute to define a region landmark.

Examples

Region Landmark Example

Developing a Keyboard Interface

Unlike native HTML form elements, browsers do not provide keyboard support for graphical user interface (GUI) components that are made accessible with ARIA; authors have to provide the keyboard support in their code. This section describes the principles and methods for making the functionality of a web page that includes ARIA widgets, such as menus and grids, as well as interactive components, such as toolbars and dialogs, operable with a keyboard. Along with the basics of focus management, this section offers guidance toward the objective of providing experiences to people who rely on a keyboard that are as efficient and enjoyable as the experiences available to others. It covers:

  1. Understanding fundamental principles of focus movement conventions used in ARIA design patterns.
  2. Maintaining visible focus, predictable focus movement, and distinguishing between keyboard focus and the selected state.
  3. Managing movement of keyboard focus between components, e.g., how the focus moves when the Tab and Shift+Tab keys are pressed.
  4. Managing movement of keyboard focus inside components that contain multiple focusable elements, e.g., two different methods for programatically exposing focus inside widgets like radio groups, menus, listboxes, trees, and grids.
  5. Managing focus for modal and non-modal dialogs.
  6. Determining when to make disabled interactive elements focusable.
  7. Assigning and revealing keyboard shortcuts, including guidance on how to avoid problematic conflicts with keyboard commands of assistive technologies, browsers, and operating systems.
  8. Addressing macro navigation concerns, i.e., methods for enabling efficient keyboard access to different sections of a page or site.

Fundamental Keyboard Navigation Conventions

ARIA roles, states, and properties model accessibility behaviors and features shared among GUI components of popular desktop GUIs, including Microsoft Windows, Mac OS X, and GNOME. Similarly, ARIA design patterns borrow user expectations and keyboard conventions from those platforms, consistently incorporating common conventions with the aim of facilitating easy learning and efficient operation of keyboard interfaces across the web.

For a web page to be accessible, all interactive elements must be operable via the keyboard. In addition, consistent application of the common GUI keyboard interface conventions described in the ARIA design patterns is important, especially for assistive technology users. Consider, for example, a screen reader user operating a tree. Just as familiar visual styling helps users discover how to expand a tree branch with a mouse, ARIA attributes give the tree the sound and feel of a tree in a desktop application. So, screen reader users will commonly expect that pressing the right arrow key will expand a collapsed node. Because the screen reader knows the element is a tree, it also has the ability to instruct a novice user how to operate it. Similarly, voice recognition software can implement commands for expanding and collapsing branches because it recognizes the element as a tree and can execute appropriate keyboard commands. All this is only possible if the tree implements the GUI keyboard conventions as described in the ARIA tree pattern.

A primary keyboard navigation convention common across all platforms is that the tab and shift+tab keys move focus from one UI component to another while other keys, primarily the arrow keys, move focus inside of components that include multiple focusable elements. The path that the focus follows when pressing the tab key is known as the tab sequence or tab ring.

Common examples of UI components that contain multiple focusable elements are radio groups, tablists, menus, and grids. A radio group, for example, contains multiple radio buttons, each of which is focusable. However, only one of the radio buttons is included in the tab sequence. After pressing the Tab key moves focus to a radio button in the group, pressing arrow keys moves focus among the radio buttons in the group, and pressing the Tab key moves focus out of the radio group to the next element in the tab sequence.

The ARIA specification refers to a discrete UI component that contains multiple focusable elements as a composite widget. The process of controlling focus movement inside a composite is called managing focus. Following are some ARIA design patterns with example implementations that demonstrate focus management:

Discernable and Predictable Keyboard Focus

When operating with a keyboard, two essentials of a good experience are the abilities to easily discern the location of the keyboard focus and to discover where focus landed after a navigation key has been pressed. The following factors affect to what extent a web page affords users these capabilities.

  1. Visibility of the focus indicator: Users need to be able to easily distinguish the keyboard focus indicator from other features of the visual design. Just as a mouse user may move the mouse to help find the mouse pointer, a keyboard user may press a navigation key to watch for movement. If visual changes in response to focus movement are subtle, many users will lose track of focus and be unable to operate. Authors are advised to rely on the default focus indicators provided by browsers. If overriding the default, consider:
    • something about ... Colors and gradients can disappear in high contrast modes.
    • Users need to be able to easily distinguish between focus and selection as described in , especially when a component that contains selected elements does not contain the focus.
    • ... other considerations to be added ...
  2. Persistence of focus: It is essential that there is always a component within the user interface that is active (document.activeElement is not null or is not the body element) and that the active element has a visual focus indicator. Authors need to manage events that effect the currently active element so focus remains visible and moves logically. For example, if the user closes a dialog or performs a destructive operation like deleting an item from a list, the active element may be hidden or removed from the DOM. If such events are not managed to set focus on the button that triggered the dialog or on the list item following the deleted item, browsers move focus to the body element, affectively causing a loss of focus within the user interface.
  3. Predictability of movement: Usability of a keyboard interface is heavily influenced by how readily users can guess where focus will land after a navigation key is pressed. Some possible approaches to optimizing predictability include:
    • Move focus in a pattern that matches the reading order of the page's language. In left to right languages, for example, create a tab sequence that moves focus left to right and then top to bottom.
    • Incorporate all elements of a section of the page in the tab sequence before moving focus to another section. For instance, in a page with multiple columns that has content in a left side bar, center region, and right side bar, build a tab sequence that covers all elements in the left sidebar before focus moves to the first focusable element in the center column.
    • When the distance between two consecutive elements in the tab sequence is significant, avoid movement that would be perceived as backward. For example, on a page with a left to right language, a jump from the last element in the bottom right of the main content to the top element in a left-hand sidebar is likely to be less predictable and more difficult to follow, especially for users with a narrow field of view.
    • Follow consistent patterns across a site. The keyboard experience is more predictable when similar pages have similar focus movement patterns.
    • Do not set initial focus when the page loads except in cases where:
      • The page offers a single, primary function that nearly all users employ immediately after page load.
      • Any given user is likely to use the page often.

Focus VS Selection and the Perception of Dual Focus

Occasionally, it may appear as if two elements on the page have focus at the same time. For example, in a multi-select list box, when an option is selected it may be greyed. Yet, the focus indicator can still be moved to other options, which may also be selected. Similarly, when a user activates a tab in a tablist, the selected state is set on the tab and its visual appearance changes. However, the user can still navigate, moving the focus indicator elsewhere on the page while the tab retains its selected appearance and state.

Focus and selection are quite different. From the keyboard user's perspective, focus is a pointer, like a mouse pointer; it tracks the path of navigation. There is only one point of focus at any time and all operations take place at the point of focus. On the other hand, selection is an operation that can be performed in some widgets, such as list boxes, trees, and tablists. If a widget supports only single selection, then only one item can be selected and very often the selected state will simply follow the focus when focus is moved inside of the widget. That is, in some widgets, moving focus may also perform the select operation. However, if the widget supports multiple selection, then more than one item can be in a selected state, and keys for moving focus do not perform selection. Some multi-select widgets do support key commands that both move focus and change selection, but those keys are different from the normal navigation keys. Finally, when focus leaves a widget that includes a selected element, the selected state persists.

From the developer's perspective, the difference is simple -- the focused element is the active element (document.activeElement). Selected elements are elements that have aria-selected="true".

With respect to focus and the selected state, the most important considerations for designers and developers are:

Keyboard Navigation Between Components (The Tab Sequence)

As explained in section , all interactive UI components need to be reachable vai the keyboard. This is best achieved by either including them in the tab sequence or by making them accessible from a component that is in the tab sequence, e.g., as part of a composite component. This section addresses building and managing the tab sequence, and subsequent sections cover making focusable elements that are contained within components keyboard accessible.

The HTML tabindex and SVG tabindex attributes can be used to add and remove elements from the tab sequence. The value of tabindex can also influence the order of the tab sequence, although authors are strongly advised not to use tabindex for that purpose.

In HTML, the default tab sequence of a web page includes only links and HTML form elements, except In Mac OS, where it includes only form elements. Mac OS system preferences include a keyboard setting that enables the tab key to move focus to all focusable elements.

The default order of elements in the tab sequence is the order of elements in the DOM. The DOM order also determines screen reader reading order. It is important to keep the keyboard tab sequence and the screen reader reading order aligned, logical, and predictable as described in . The most robust method of manipulating the order of the tab sequence while also maintaining alignment with the reading order that is currently available in all browsers is rearranging elements in the DOM.

The values of the tabindex attribute have the following effects.

tabindex is not present or does not have a valid value
The element has its default focus behavior. In HTML, only form controls and anchors with an HREF attribute are included in the tab sequence.
tabindex="0"
The element is included in the tab sequence based on its position in the DOM.
tabindex="-1"
The element is not included in the tab sequence but is focusable with element.focus().
tabindex="X" where X is an integer in the range 1 <= X <= 32767
Authors are strongly advised NOT to use these values. The element is placed in the tab sequence based on the value of tabindex. Elements with a tabindex value of 0 and elements that are focusable by default will be in the sequence after elements with a tabindex value of 1 or greater.

Keyboard Navigation Inside Components

As described in section , the tab sequence should include only one focusable element of a composite UI component. Once a composite contains focus, keys other than Tab and Shift+Tab enable the user to move focus among its focusable elements. Authors are free to choose which keys move focus inside of a composite, but they are strongly advised to use the same key bindings as similar components in common GUI operating systems as demonstrated in .

The convention for where focus lands in a composite when it recieves focus as a result of a Tab key event depends on the type of composite. It is typically one of the following.

The following sections explain two strategies for managing focus inside composite elements: creating a roving tabindex and using the aria-activedescendant property.

Managing Focus Within Components Using a Roving tabindex

When using roving tabindex to manage focus in a composite UI component, the element that is to be included in the tab sequence has tabindex of "0" and all other focusable elements contained in the composite have tabindex of "-1". The algorithm for the roving tabindex strategy is as follows.

  • When the component container is loaded or created, set tabindex="0" on the element that will initially be included in the tab sequence and set tabindex="-1" on all other focusable elements it contains.
  • When the component contains focus and the user presses a navigation key that moves focus within the component, such as an arrow key:
    • set tabindex="-1" on the element that has tabindex="0".
    • Set tabindex="0" on the element that will become focused as a result of the key event.
    • Set focus, element.focus(), on the element that has tabindex="0".
  • If the design calls for a specific element to be focused the next time the user moves focus into the composite with Tab or Shift+Tab, check if that target element has tabindex="0" when the composite loses focus. If it does not, set tabindex="0" on the target element and set tabindex="-1" on the element that previously had tabindex="0".

One benefit of using roving tabindex rather than aria-activedescendant to manage focus is that the user agent will scroll the newly focused element into view.

Managing Focus in Composites Using aria-activedescendant

If a component container has an ARIA role that supports the aria-activedescendant property, it is not necessary to manipulate the tabindex attribute and move DOM focus among focusable elements within the container. Instead, only the container element needs to be included in the tab sequence. When the container has DOM focus, the value of aria-activedescendant on the container tells assistive technologies which element is active within the widget. Assistive technologies will consider the element referred to as active to be the focused element even though DOM focus is on the element that has the aria-activedescendant property. And, when the value of aria-activedescendant is changed, assistive technologies will receive focus change events equivalent to those received when DOM focus actually moves.

The steps for using the aria-activedescendant method of managing focus are as follows.

  • When the container element that has a role that supports aria-activedescendant is loaded or created, ensure that:
    • The container element is included in the tab sequence as described in or it is otherwise focusable as described in .
    • It has aria-activedescendant="IDREF" where IDREF is the ID of the element within the container that should be identified as active when the widget receives focus. The referenced element needs to meet the DOM relationship requirements described below.
  • When the container element receives DOM focus, draw a visual focus indicator on the active element and ensure the active element is scrolled into view. See section Managing Focus with Scroll below for more information.
  • When the composite widget contains focus and the user presses a navigation key that moves focus within the widget, such as an arrow key:
    • Change the value of aria-activedescendant on the container to refer to the element that should be reported to assistive technologies as active.
    • Move the visual focus indicator and, if necessary, scrolled the active element into view.
  • If the design calls for a specific element to be focused the next time a user moves focus into the composite with Tab or Shift+Tab, check if aria-activedescendant is referring to that target element when the container loses focus. If it is not, set aria-activedescendant to refer to the target element.

The specification for aria-activedescendant places important restrictions on the DOM relationship between the focused element that has the aria-activedescendant attribute and the element referenced as active by the value of the attribute. One of the following three conditions must be met.

  1. The element referenced as active is a DOM descendant of the focused referencing element.
  2. The focused referencing element has a value specified for the aria-owns property that includes the ID of the element referenced as active.
  3. The focused referencing element has role of textbox and has aria-controls property referring to an element with a role that supports aria-activedescendant and either:
    1. The element referenced as active is a descendant of the controlled element.
    2. The controlled element has a value specified for the aria-owns property that includes the ID of the element referenced as active.

Nested Composite Components - Composites and Toolbars That Contain Composites

to be written

Managing Focus with Scroll

Not yet edited ... considering what should be written/included. We don't want to write a javascript book.

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 scroll the element into view. scrollTop and scrollLeft adjust 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 it's viewable within the context of its parent node. Then you have to move up the DOM tree and make each parent node visible.

For example, create a custom scrollIntoView() method that is called at various times, including coincidence with the setting of the aria-activedescendant property. The method 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.

This is 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 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 vice 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 because it is sometimes negative and sometimes positive especially with respect to inner (nested) scrollbars. Different browsers handle right-to-left completely differently.

Focusability of disabled controls

By default, disabled HTML input elements are removed from the tab sequence. In most contexts, the normal expectation is that disabled interactive elements are not focusable. However, there are some contexts where it is common for disabled elements to be focusable, especially inside of composite widgets. For example, as demonstrated in the pattern, disabled items are focusable when navigating through a menu with the arrow keys.

Removing focusability from disabled elements can offer users both advantages and disadvantages. Allowing keyboard users to skip disabled elements usually reduces the number of key presses required to complete a task. However, preventing focus from moving to disabled elements can hide their presence from screen reader users who "see" by moving the focus.

Authors are encouraged to adopt a consistent set of conventions for the focusability of disabled elements. The examples in this guide adopt the following conventions, which both reflect common practice and attempt to balance competing concerns.

  1. For elements that are in the tab sequence when enabled, remove them from the tab sequence when disabled.
  2. For the following composite widget elements, keep them focusable when disabled:
  3. For elements contained in a toolbar, make them focusable if discoverability is a concern. Here are two examples to aid with this judgment.
    1. A toolbar with buttons for moving, removing, and adding items in a list includes buttons for "Up", "Down", "Add", and "Remove". The "Up" button is disabled and its focusability is removed when the first item in the list is selected. Given the presence of the "Down" button, discoverability of the "Up" button is not a concern.
    2. A toolbar in an editor contains a set of special smart paste functions that are disabled when the clipboard is empty or when the function is not applicable to the current content of the clipboard. It could be helpful to keep the disabled buttons focusable if the ability to discover their functionality is primarily via their presence on the toolbar.

One design technique for mitigating the impact of including disabled elements in the path of keyboard focus is employing appropriate keyboard shortcuts as described in .

Keyboard Shortcuts

When effectively designed, keyboard shortcuts that focus an element, activate a widget, or both can dramatically enhance usability of frequently used features of a page or site. This section addresses some of the keyboard shortcut design and implementation factors that most impact their effectiveness, including:

  1. Understanding how keyboard shortcuts augment a keyboard interface and whether to make a particular shortcut move focus, perform a function, or both.
  2. Making key assignments and avoiding assignment conflicts with assistive technologies, browsers, and operating systems.
  3. Exposing and documenting key assignments.

Designing the Scope and Behavior of Keyboard Shortcuts

This section explains the following factors when determining which elements and features to assign keyboard shortcuts and what behavior to give each shortcut:

  1. Ensuring discovery through navigation; keyboard shortcuts enhance, not replace, standard keyboard access.
  2. Effectively choosing from among the following behaviors:
    1. Navigation: Moving focus to an element.
    2. Activation: Performing an operation associated with an element that does not have focus and might not be visible.
    3. Navigation and activation: Both moving focus to an element and activating it.
  3. Balancing efficiency and cognitive load: lack of a shortcut can reduce efficiency while too many shortcuts can increase cognitive load and clutter the experience.
Ensure Basic Access Via Navigation

Before assigning keyboard shortcuts, it is essential to ensure the features and functions to which shortcuts may be assigned are keyboard accessible without a keyboard shortcut. In other words, all elements that could be targets for keyboard shortcuts need to be focusable via the keyboard using the methods described in:

Do not use keyboard shortcuts as a substitute for access via navigation. This is essential to full keyboard access because:

  1. The primary means of making functions and their shortcuts discoverable is by making the target elements focusable and revealing key assignments on the element itself.
  2. If people who rely on the keyboard have to read documentation to learn which keys are required to use an interface, the interface may technically meet some accessibility standards but in practice is only accessible to the small subset of them who have the knowledge that such documentation exists, have the extra time available, and the ability to retain the necessary information.
  3. Not all devices that depend on keyboard interfaces can support keyboard shortcuts.
Choose Appropriate Shortcut Behavior

The following conventions may help identify the most advantageous behavior for a keyboard shortcut.

  • Move focus when the primary objective is to make navigation more efficient, e.g., reduce the number of times the user must press Tab or the arrow keys. This behavior is commonly expected when assigning a shortcut to a text box, toolbar, or composite, such as a listbox, tree, grid, or menubar. This behavior is also useful for moving focus to a section of a page, such as the main content or a complementary landmark section.
  • Activate an element without moving focus when the target context of the funtion is the context that contains the focus. This behavior is most common for command buttons and for functions associated with elements that are not visible, such as a "Save" option that is accessible via a menu. For example, if the focus is on an option in a listbox and a toolbar contains buttons for moving and removing options, it is most benefitial to keep focus in the listbox when the user presses a key shortcut for one of the buttons in the toolbar. This behavior can be particularly important for screen reader users because it provides confirmation of the action performed and makes performing multiple commands more efficient. For instance, when a screen reader user presses the shortcut for the "Up" button, the user will be able to hear the new position of the option in the list since it still has the focus. Similarly, when the user presses the shortcut for deleting an option, the user can hear the next option in the list and immediately decide whether to press the delete shortcut again.
  • Move focus and activate when the target of the shortcut has a single function and the context of that function is the same as the target. This behavior is typical when a shortcut is assigned to a button that opens a menu or dialog, to a checkbox, or to a navigation link or button.
Choose Where to Add Shortcuts

The first goal when designing a keyboard interface is simple, efficient, and and intuitive operation with only basic keyboard navigation support. If basic operation of a keyboard interface is inefficient , attempting to compensate for fundamental design issues, such as suboptimal layout or command structure, by implementing keyboard shortcuts will not likely reduce user frustration. The practical implication of this is that, in most well-designed user interfaces, the percentage of functionality that needs to be accessible via a keyboard shortcut in order to create optimal usability is not very high. In many simple user interfaces, keyboard shortcuts can be entirely superfluous. And, in user interfaces with too many keyboard shortcuts, the excess shortcuts create cognitive load that make the most useful ones more difficult to remember.

Consider the following when deciding where to assign keyboard shortcuts:

  1. To be written ... stream of consciousness includes frequency of use, repetitive operations, amount of benefit (key presses saved), minimizing the number with placement, e.g., focus on a menubar with first letter nav vs assigning shortcuts to individual menuitems.

Assigning Keyboard Shortcuts

When choosing the keys to assign to a shortcut, there are many factors to consider.

  • Making the shortcut easy to learn and remember by using a mnemonic (e.g., "S" for "Save") or following a logical or spacial pattern.
  • Localizing the interface, including for differences in which keys are available and how they behave and for language considerations that could impact mnemonics.
  • Avoiding and managing conflicts with key assignments used by an assistive technology, the browser, or the operating system.

Methods for designing a key shortcut scheme that supports learning and memory is beyond the scope of this guide. Unless the key shortcut scheme is extensive, it is likely sufficient to mimic concepts that are familiar from common desktop software, such as browsers. Similarly, while localization is important, describing how to address it is left to other resources that specialize in that topic.

The remainder of this section provides guidance balancing requirements and concerns related to key assignment conflicts. It is typically ideal if key assignments do not conflict with keys that are assigned to functions in the user's operating system, browser, or assistive technology. Conflicts can block efficient access to functions that are essential to the user, and a perfect storm of conflicts can trap a user. At the same time, there are some circumstances where intentional conflicts are useful. And, given the vast array of operating system, browser, and assistive technology keys, it is almost impossible to be certain conflicts do not exist. So it is also important to employ strategies that mitigate the impact of conflicts whether they are intentional or unknown.

In the following sections, meta key refers to the Windows key on Windows-compatible keyboards and the Command key on MacOS-compatible keyboards.

Operating System Key Conflicts

It is essential to avoid conflicts with keys that perform system level functions, such as appplication and window management and display and sound control. In general, this can be achieved by refraining from the following types of assignments.

  1. Any modifier keys + any of Tab, Enter, Space, or Escape.
  2. Meta key + any other single key (there are exceptions, but they can be risky as these keys can change across versions of operating systems).
  3. Alt + a function key.

In addition, there are some important application level features that most applications, including browsers, generally support. These include:

  1. Zoom
  2. Copy/Paste
  3. ... to be continued ...
Assistive Technology Key Connflicts

Even though assistive technologies have collectively taken thousands of key assignments, avoiding conflicts is relatively easy. This is because assistive technologies have had to develop key assignment schemes that avoid conflicts with both operating systems and applications. They do this by hijacking specific keys as modifiers that uniquely define their key commands. For example, many assistive technologies use the Caps Lock key as a modifier.

Deflect assistive technology key conflicts by steering clear of the following types of assignments.

  1. Caps Lock + any other combination of keys.
  2. Insert + any combination of other keys.
  3. Scroll Lock + any combination of other keys.
  4. Mac OS only: Control+Option + any combination of other keys.
Browser Key Connflicts

While there is considerable similarity among browser keyboard schemes, the patterns within the schemes are less homogenious. Consequently, it is more difficult to avoid conflicts with browser key assignments. While the impact of conflicts is sometimes mitigated by the availability of two paths to nearly every function -- keyboard accessible menus and keyboard shortcuts, avoiding conflicts with shortcuts to heavily used functions is nonetheless important. Pay special attention to avoiding conflicts with shortcuts to:

  1. Address or location bar
  2. Notification bar
  3. Page refresh
  4. Bookmark and history functions
  5. Find functions
Mitigating Key Connflict Likelihood and Impact
Intentional Key Conflicts

While avoiding key conflicts is usually desirable, there are circumstances where intentionally conflicting with a browser function is acceptable or even desirable. This can occur when the following combination of conditions arises:

  • A web application has a frequently used function that is similar to a browser function.
  • Users will often want to execute the web application function.
  • Users will rarely execute the browser function.
  • There is an efficient, alternative path to the browser function.

For example, consider a save function that is available when the focus is in an editor. Most browsers use ... to be continued ...

Exposing and Documenting Keyboard Shortcuts

This is where we will talk about how the keyshortcuts property exposes shortcuts to assistive technology, visual exposure via tooltips, and the like. We will also cover making it easy to find documentation, such as in an accessibility section in help or a keyboard shortcuts option in a help menu.

Implementing keyboard shortcuts

Not sure if we will have this section ... could include some js tips and note about access keys ... accesskey behave differently in different browsers.

Other Keyboard Interface Development Tips

MCK: this section is a collection of keyboard related old content with a yet undecided fate.

Miscelaneous stuff we might or might not keep

  • Use focus and blur events (or event delegation) to monitor changes to the current focus - focus and blur events can now be used with every element. 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. Techniques such as "event delegation" (for example, intercepting events on a list rather than on every listitem) can improve performance.
  • 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 - Key press events do not fire for all keys and they vary across browsers.
  • Use element.focus() to set focus - Do not use createEvent(), initEvent() and dispatchEvent() to send focus to an element, because these functions do not change the focus. DOM focus events are informational only, generated by the user agent after an element has acquired focus, but not used themselves to set focus.
  • The use of :focus pseudo-class selectors to style the keyboard focus is not supported in many versions of Internet Explorer. Authors should use the :active pseudo-class (which older versions of IE treat like :focus) in conjunction with the :focus pseudo-class. Example: a:focus, a:active { text-decoration: underline; } If the related CSS pseudo-classes are not appropriate or not supported in all browsers, authors can use JavaScript techniques to indicate an appropriate focus alternative, such as using focus and blur events to toggle a classname on an element.
  • Always draw the focus for tabindex="-1" items and elements that receive focus programmatically when supporting versions of Internet Explorer older than 8 - 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" onkeypress="return  handleKeyPress();"> 

    If handleKeyDown() returns false, the event will be consumed, preventing the browser from performing any action based on the keystroke. In addition to the return value the browser must call the event methods that will prevent the default action, for IE this is setting the event property "returnValue=false", and for other browsers supporting the W3C event model this means calling the "preventDefault" method of the event object.

  • 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. There are user agent-specific considerations for key event handling.

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. To provide simple text tooltips, the HTML title attribute should more than suffice because the user agent will render it for tooltips. When creating a tooltip, it is essential that the user 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. Browsers do not currently support this functionality.

The following code snippet from the iCITA site shows the use of a onfocus="tooltipShow();" function to display the tooltip when focus is placed on an element.

<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"
          onmouseover="tooltipShow(event, this, 'tp1');"
          onfocus="tooltipShow(event, this,  'tp1');"
          aria-describedby="tp1"
          aria-required="false"/>

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

Grid and Table Properties

[placeholder]. This section will cover colcount, rowcount, colindex, rowindex, colspan, rowspan, and sort. It will explain when they are useful and how to use them. It is referenced by the grid and table design patterns. This section will refer readers to the grid and table design patterns for the basics of grid and table.

Appendices

Understanding Screen Reader Document Reading and Application Reading Modes

Placeholder for a section covering this topic that is yet to be written.

Background on WAI-ARIA

[Placeholder section that will be resolved by issue #84.]