Home
-Sample content section. Activating a link above will update and navigate to this region.
-diff --git a/.eslintignore b/.eslintignore index 5607b9b504..02825e8cb0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,5 @@ **/*.min.js common/ -examples/landmarks/js/visua11y.js -examples/js/highlight.pack.js -examples/js/skipto.js +content/patterns/landmarks/examples/js/visua11y.js +content/shared/js/highlight.pack.js +content/shared/js/skipto.js diff --git a/.eslintrc.json b/.eslintrc.json index e8e3bc1df3..7e40af6dbc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -63,6 +63,14 @@ "strict": 0, "no-unused-vars": ["error", { "varsIgnorePattern": "SkipToConfig" }] } + }, + { + "files": [ "content/shared/js/app.js" ], + "parserOptions": { "ecmaVersion": 11 } + }, + { + "files": [ "content/shared/js/specLinks.mjs" ], + "parserOptions": { "sourceType": "module" } } ] } diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml index 96847dcbfe..80f8307bc4 100644 --- a/.github/workflows/coverage-report.yml +++ b/.github/workflows/coverage-report.yml @@ -3,9 +3,9 @@ name: Regression Tests Coverage Report on: pull_request_target: paths: - - "examples/**" + - "content/**/examples/**" - "test/**" - - "!examples/landmarks/**" + - "!content/landmarks/examples/**" permissions: contents: read diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 02be06404a..d06e1df89b 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -7,13 +7,13 @@ on: paths: - "package*.json" - ".github/workflows/examples.yml" - - "examples/**" + - "content/**/examples/**" - "scripts/reference-tables.*" pull_request: paths: - "package*.json" - ".github/workflows/examples.yml" - - "examples/**" + - "content/**/examples/**" - "scripts/reference-tables.*" jobs: diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml new file mode 100644 index 0000000000..10407a0000 --- /dev/null +++ b/.github/workflows/link-checker.yml @@ -0,0 +1,22 @@ +name: Link Checker + +on: [push, pull_request] + +jobs: + link-checker: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + cache: npm + + - name: Install npm dependencies + run: npm ci + + - name: Run link checker + run: npm run link-checker diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index b355458637..7ea03368f5 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -6,9 +6,8 @@ on: - ".github/workflows/regression.yml" - "package*.json" - "test/**" - - "examples/**" - - "!examples/landmarks/**" - - "!examples/coding-template/**" + - "content/**/examples/**" + - "!content/landmarks/examples/**" push: branches-ignore: - main @@ -17,9 +16,8 @@ on: - ".github/workflows/regression.yml" - "package*.json" - "test/**" - - "examples/**" - - "!examples/landmarks/**" - - "!examples/coding-template/**" + - "content/**/examples/**" + - "!content/landmarks/examples/**" jobs: regression: diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 7372b391df..a466c8c61a 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -9,8 +9,7 @@ on: - "!**/*.min.js" - "!**/*.pack.js" - "!**/*.paint" - - "!aria-practices-DeletedSectionsArchive.html" - - "!examples/landmarks/css/bootstrap.css" + - "!content/patterns/landmarks/examples/css/bootstrap.css" - "!common/**" - "!respec-config.js" @@ -20,8 +19,7 @@ on: - "!**/*.min.js" - "!**/*.pack.js" - "!**/*.paint" - - "!aria-practices-DeletedSectionsArchive.html" - - "!examples/landmarks/css/bootstrap.css" + - "!content/patterns/landmarks/examples/css/bootstrap.css" - "!common/**" - "!respec-config.js" diff --git a/.github/workflows/wai-trigger-deploy.yml b/.github/workflows/wai-trigger-deploy.yml index f06dee7604..ee93cd326b 100644 --- a/.github/workflows/wai-trigger-deploy.yml +++ b/.github/workflows/wai-trigger-deploy.yml @@ -7,7 +7,7 @@ on: paths: - ".github/workflows/wai-trigger-deploy.yml" - "common/**" - - "examples/**" + - "content/**/examples/**" - "img/**" - "aria-practices.html" - "index.html" diff --git a/.github/workflows/wai-trigger-pr.yml b/.github/workflows/wai-trigger-pr.yml index e0cbc5093c..ae5f28da13 100644 --- a/.github/workflows/wai-trigger-pr.yml +++ b/.github/workflows/wai-trigger-pr.yml @@ -11,11 +11,11 @@ on: - "scripts/reference-tables.*" - "**/*.js" - "test/**" - - "examples/**" + - "content/**/examples/**" - "aria-practices.html" - "index.html" - - "!examples/landmarks/**" - - "!examples/coding-template/**" + - "!content/landmarks/examples/**" + - "!coding-template/**" - "!common/**" jobs: diff --git a/.link-checker.js b/.link-checker.js new file mode 100644 index 0000000000..d3a1ff3fda --- /dev/null +++ b/.link-checker.js @@ -0,0 +1,19 @@ +module.exports = { + filesToIgnore: ['content/shared/templates/example-usage-warning.html'], + excludedLinks: { + 'content/patterns/menubar/examples/menubar-navigation.html': [ + '#ex1 [role=menuitem]', + ], + 'content/patterns/treeview/examples/treeview-navigation.html': [ + '#ex1 [role=treeitem]', + ], + 'content/patterns/carousel/examples/carousel-2-tablist.html': [ + '.carousel-image a', + ], + }, + ignoreHashesOnExternalPagesMatchingRegex: [ + // Some hash links are resolved with JS and are therefore difficult to check algorithmically + /^https:\/\/github\.com\/.*\/wiki\//, + /^https:\/\/html\.spec\.whatwg\.org\/multipage\//, + ], +}; diff --git a/aria-practices-DeletedSectionsArchive.html b/aria-practices-DeletedSectionsArchive.html deleted file mode 100644 index 77323337d0..0000000000 --- a/aria-practices-DeletedSectionsArchive.html +++ /dev/null @@ -1,3665 +0,0 @@ - - -
-- This document is a placeholder for sitnificatn sections of content that were removed from the ARIA Authoring Practices Guide. - It allows reviewers to more easily see what was removed, and makes it easier to restore content. -
-This content could be useful when working on issue 73.
-At this point you should have a basic understanding of how WAI-ARIA is used to support interoperability with assistive technologies. If you are not reusing a WAI-ARIA-enabled widget library and wish to create your own the following steps will guide you through the thought process for creating an accessible widget using WAI-ARIA.
-Pick the widget type (role) from the WAI-ARIA taxonomy
-WAI-ARIA provides a role taxonomy ([[WAI-ARIA]], Section 3.4) constituting the most common UI component types. Choose the role type from the provided table. If your desire was to create a toolbar set the role to toolbar:
-<div role="toolbar">-
Once you have chosen the role of your widget, consult the [[WAI-ARIA]] for an in-depth definition for the role to find the supported states, properties, and other attributes. For example, the toolbar role definition includes:
-Once you have chosen the states and properties that apply to your widget you must set those properties you will use to set their initial values. Note: You do not need to use all the states and properties available for your role. In our case we shall use:
-<div role="toolbar" id="customToolbar" tabindex="0" aria-activedescendant="button1" - onkeydown="return optionKeyEvent(event);" - onkeypress="return optionKeyEvent(event);" - onblur="hideFocus();" - onfocus="showFocus();" - > - <img src="img/btn1.gif" title="Home" alt="Home" role="button" id="button1" - onclick="updateText('Home was invoked');"> - <img src="img/btn2.gif" title="Refresh" alt="Refresh" role="button" id="button2" - onclick="updateText('Refresh was invoked');"> - <img src="img/btn3.gif" title="Help" alt="Help" role="button" id="button3" - onclick="updateText('Help was invoked');"> -</div> --
By setting tabindex=0 on the toolbar, the toolbar will receive focus in the document order. It is necessary then to use script and the aria-activedescendant property to manage virtual focus among the buttons. The details are given in step five, below.
-Important: When embedding WAI-ARIA markup in (X) HTML, all WAI-ARIA states and properties must be preceded with the characters aria-
with the exception of the role
and tabindex
attributes. Otherwise, the user agent will not map the WAI-ARIA information, resulting in it not being recognized by assistive technologies.
When embedding WAI-ARIA into other host languages, tabindex
does not carry over. The WAI-ARIA tabindex
extensions are specific to (X)HTML to repair deficiencies in keyboard support.
Assistive technologies are very dependent on the structure of widgets as well as general document structure. Structure provides context to the user. A toolbar is a collection of common functions made available to the user. Therefore, all functions you would like in the toolbar must be contained within it. This can be determined by using the [[dom]] tree structure created by the browser when parsing the host language. By using the parent child relationship of the DOM, an assistive technology can determine all the related toolbar widgets associated with the toolbar. The toolbar widgets would be DOM children of the "toolbar" container. For our purposes we will define three image buttons for cut, copy, and paste.
-<div role="toolbar" tabindex="0" aria-activedescendant="button1"> - <img src="buttoncut.png" alt="cut" id="button1"> - <img src="buttoncopy.png" alt="copy" id="button2"> - <img src="buttonpaste.png" alt="paste" id="button3"> -</div>-
We now need to assign the roles and states for each of the children. However, we shall save the detailed navigation for step 5.
-<div role="toolbar" tabindex="0" aria-activedescendant="button1"> - <img src="buttoncut.png" alt="cut" role="button" id="button1"> - <img src="buttoncopy.png" alt="copy" role="button" id="button2"> - <img src="buttonpaste.png" alt="paste" role="button" id="button3"> -</div> --
The process of setting roles and states may be a recursive procedure if the children themselves have children, such as in the case of an expandable/collapsible tree widget.
-Establish keyboard navigation of the widget and plan for how it will be navigated to within the document
-It is very important that your widget be keyboard accessible. In fact, there must be a keyboard equivalent for every mouse operation. Where possible you should refer to the WAI-ARIA examples in this guide for tips on how to implement keyboard navigation for your widget. If you find that an example is not provided, you should follow standard keyboard bindings for UI components such as those used for the Java Foundation Classes for Windows 95/NT.
-Commented out link to conference paper, which a) was broken, and b) we should have more canonical references than conference papers for things like this.
-For our toolbar, we have chosen to have the toolbar manage the focus for its children and through the use of the aria-activedescendant property. We have also chosen to have the toolbar receive focus based on the tab order by using tabindex
. In order to use aria-activedescendant, each focusable descendant must have an assigned ID.
<head> - <script> - … - function optionKeyEvent(event) - { - var tb = event.target; - var buttonid; - - DOM_VK_ENTER = 13; - // Partial sample code for processing arrow keys - - if (event.type == "keydown") { - if (event.altKey) { - return true; // Browser should use this, the menu view doesn't need alt-modified keys - } - // XXX Implement circular keyboard navigation within the toolbar buttons - - if (event.keyCode == DOM_VK_ENTER) { - ExecuteButtonAction(getCurrentButtonID()); // This is an author defined function - } - else if (event.keyCode == event.DOM_VK_RIGHT) { - // Change the active toolbar button to the one to the right (circular) by - var buttonid = getNextButtonID(); // This is an author defined function - tb.setAttribute("aria-activedescendant", buttonid); - } - else if (event.keyCode == event.DOM_VK_LEFT) { - // Change the active toolbar button to the one to the left (circular) by - var buttonid = getPrevButtonID(); // This is an author defined function - tb.setAttribute("aria-activedescendant", buttonid); - } - else { - return true; - } - return false; - } - else if (event.type == "keypress") { - … - } - } -</script> - -<div role="toolbar" tabindex="0" aria-activedescendant="button1" id="tb1" - onkeydown="return optionKeyEvent(event);" - onkeypress="return optionKeyEvent(event);"> - <img src="buttoncut.png" alt="cut" role="button" id="button1"> - <img src="buttoncopy.png" alt="copy" role="button" id="button2"> - <img src="buttonpaste.png" alt="paste" role="button" id="button3"> -</div>-
The details of implementing keyboard navigation are described in Keyboard and Structural Navigation section of this document.
-You must also show the visual focus for each element that has focus.
-Apply and manage needed WAI-ARIA states in response to user input events
-Similar to the processing of aria-activedescendant in Step 5, as author you must set any additional WAI-ARIA states and properties on document elements.
-Synchronize the visual UI with accessibility states and properties for supporting user agents
-Thomas comment: is confusing that the example switches from toolbar to treeitem. Maybe the best overall sample is to do a tree because it demonstrates each of the points you want to make?
-You should consider binding user interface changes directly to changes in WAI-ARIA states and properties, such as through the use of CSS attribute selectors. For example, the setting of the aria-selected state may change the background of a selected treeitem in a tree. This may also be done with JavaScript.
--.treeitem[role="treeitem"][aria-selected="true"] {color: white; background-color: #222222;} - -.treeitem[role="treeitem"][aria-selected="false"] {color: white; background-color: beige;}-
Authors should be aware that CSS attribute selectors are not supported in some browsers, such as Internet Explorer 6. A consistent way to apply styling to reflect WAI-ARIA semantics would be to assign an element a class name based on the WAI-ARIA attribute being set using script as shown here:
-function setSelectedOption(menuItem) - { - if (menuItem.getAttribute("role") != "menuitem") { - return; - } - var menu = getMenu(menuItem); - var oldMenuItem = getSelectedOption(menu); - - // Set class so that we show selection appearance - oldMenuItem.className="unselected"; - menu.setAttribute("aria-activedescendant", menuItem.id); - menuItem.className= "selected"; - }-
The proper synchronization of showing and hiding sections in a widget with the WAI-ARIA display state is also critical. Some platform accessibility APIs provide events for applications to notify the assistive technology when pop-ups such as menus, alerts, and dialogs come into view or go away. Rich Internet applications can assist browsers which support these conventions by:
-Creating an entire section and then insert it into the [[dom]], as a subtree of the parent element activated to show the pop-up, and then removing the section from the inserted area when the pop-up goes away.
-OR
-Using the following style sheet properties to show and hide document sections being used to represent the pop-up items, menus or dialogs:
-display:block
display:none
visibility:visible
visibility:hidden
By monitoring these behaviors a user agent may use this information to notify assistive technology that the pop-up has occurred by generating the appropriate accessibility API event.
-Some assistive technologies may use the DOM directly to determine these when pop-up occurs. In this case, the first mechanism of writing a section to the DOM would work using the DOM events as demonstrated here.
-- // create new table row with table cell and div - var newTr = document.createElement('TR'); - var newTd = document.createElement('TD'); - var newDiv = document.createElement('DIV'); - newTr.appendChild(newTd); - newTd.appendChild(newDiv); - - - //insert this new table row before the Node selected - var container = theNode.parentNode; - container.insertBefore(newTr, theNode); - - //remove theNode selected - container.removeChild(theNode);"-
However, if you are using CSS to show and hide sections of the DOM (2) it is essential that you set the corresponding WAI-ARIA aria-hidden property to indicate that the section is visible or hidden and synchronize it with your CSS styling as shown here:
-[aria-hidden=true] {visibility: hidden;} - -… - -<div role="button" aria-haspopup="true" aria-owns="mypopupmenu"> -<div role="menu" aria-hidden="true" id="mypopupmenu">…</div>-
When an image is used to represent information within a component, such as image buttons, you need to set the alternative text on those images. This is then mapped by the user agent to the accessible name in the platform accessibility API. Using our example:
-<div role="toolbar" tabindex="0" aria-activedescendant="button1" id="tb1" - onkeydown="return optionKeyEvent(event);" - onkeypress="return optionKeyEvent(event);"> - <img src="buttoncut" role="button" id="button1" alt="cut"> - <img src="buttoncopy" role="button" id="button2" alt="copy"> - <img src="buttonpaste" role="button" id="button3" alt="paste"> -</div>-
Once you have made the basic widget accessible you may then need to establish its relationship to other widgets. Examples of this are aria-labelledby, aria-controls, aria-describedby and aria-flowto. The details of using these relationships are described in the Relationships section of this document.
-Other relationships which should be considered are more declarative and provide context to the widget within a set. For these, aria-level, aria-posinset, and aria-setsize are provided. If you structure your Document Object Model appropriately so that the user agent can determine this information from it using the DOM hierarchy directly, you do not need to set these properties. There are, however, situations in rich internet applications where all the elements in a container are not in the DOM at one time, such as when you can only render the ten of fifty items in a subtree. In this case the user agent cannot determine the number of tree items (aria-setsize) for the position in the set (aria-posinset), and potentially the tree depth (aria-level) from the DOM. In these situations you will need to provide these WAI-ARIA properties.
-Review widget to ensure that you have not hard coded sizes
-The ability for applications to respond to system font settings is a requirement. Most user agents are designed to meet this requirement. This also means your Web application running within your browser is impacted when the user agent changes the font sizes to meet the need. If you have hard coded your font size in pixels an increase in system fonts will not be reflected in your Web application. You must also not hard code the size of your widgets in pixels either. If the fonts are scalable, but the widget they are encapsulated in is not, then the text could flow outside your widget.
-Follow these rules to allow your application to respond to system font settings:
--Percentages are the most reliable way to consistently specify proportional text sizes in widgets. The use of percentages and em should be used for specifying widths of a widget and the widget sub components. The use of percentages for text size and percentages and em units for widths support browser zoom capabilities to make widgets larger or smaller. - -Pixels can be used for specifying line widths, padding and margins.
-Important: Most browsers today have a zoom feature which allow the user to magnify the entire Web page. Most legislation today requires that your application respond to system font and color settings and therefore you will want to consider the fact the system settings could adversely affect your Web page should you decide to hard code pixel sizes.
-Authors use background images when styling their widgets, including situations where the background image is not merely decorative, but informative. An example is a horizontal progress bar that it is filled by gradually revealing more of a background image. This is accomplished by initially setting the width of the element to zero, and then incrementing its width in accordance with the degree of progress.
-High contrast mode is an operating system display modification that makes the screen easier to see for low vision users. Some operating systems (e.g., Windows), do not display background images when in high contrast mode. Consequently, the progress bar described above appears empty regardless of the progress. It is recommended that authors not use background images as the sole method to convey important information, and to compensate with alternative or additional style rules.
-In the case of the progress bar example, a technique that works when in high contrast mode is to style the element with a border. Since the width of the element is updated as progress increases, its border gradually expands horizontally forming an ever wider unfilled rectangle. This provides alternative visual feedback as to the extent of the progress.
-Another technique is to replace a background image with text. Consider a dialog that uses a background image for its close box. To compensate for the missing close box when in high contrast mode, a lower case 'x' is used instead. The compensation technique used depends on the context, particularly the purpose of the background image.
-There are two general approaches with respect to detecting high contrast mode. They are (1) executing a script to determine if the system is in high contrast mode, or (2) providing a preference to use alternative styles. The advantage of automatic detection is that some operating systems simply apply a different color palette when in high contrast mode and do not turn off background images. In that case, authors need not compensate for missing background images. However, detection of high contrast mode by script is relatively expensive compared to a preference that users can set, and, presumably, users can see whether background images are displayed in high contrast mode on their system. It is up to individual authors to decide which method they find acceptable for their particular situation.
-The following code fragment outlines how to detect high contrast mode.
--/* Define styles for the high contrast test element */ -#hiContrastTestEl { - border: 1px solid; - border-color:red green; - position: absolute; - height: 5px; - top: -999px; - background-image: url('resources/blank.gif'); -} -… -// An onload event handler that inserts the high contrast test element and -// then tests its computed styles. -function detectHiContrast() { - var div = document.createElement('div'); - div.setAttribute ('id', 'hiContrastTestEl'); - // … append <div#hiContrastTestEl> to the <body> element … - var cs = window.getComputedStyle(div); - var bki = cs.backgroundImage; - var hiContrast = false; - - // The CSS sets the top and right borders of the test element to red and - // green, respectively. In high contrast mode either the borders are - // the same color, or there is no legitimate url to the background image. - hiContrast = (cs.borderTopColor == cs.borderRightColor) || - (bki != null && (bki == 'none' || bki == 'url (invalid-url:)')); - - if (hiContrast) { - // apply hi contrast styles to compensate for missing background images. - } - // … remove the test element from the document … -}-
To ensure you have set your WAI-ARIA semantics correctly, test your application with your user agent, an assistive technology, and a person with disability. Example assistive technologies are screen readers and screen magnifiers. Ensure that your user agent is designed to support WAI-ARIA and their your assistive technology is designed to support WAI-ARIA in the selected user agent.
-Finding people with disabilities to do testing may be difficult but many companies employ people with disabilities, including your customers, and you should reach out to them to ask for help. Other places to look are advocacy groups like the National Federation of the Blind or your local schools for the blind, reading and learning centers, and so on. The people you reach out to may someday need to use what you produce.
-- Matt King: Removed on July 10 per discussion in May 23, 2016 meeting. - This section is redundant given the new landmark section. - The parts that are not redundant are either out-of-date or not necessary. The possible exceptions are content covering the group and directory roles. -
-- This section takes a broader look at the Web page. - It is intended to assist you in conveying a logical, usable, and accessible layout to an assistive technology or adaptive system designed to modify the visual layout to meet the users needs. -
-- One of the deficiencies of (X)HTML for disabled users has been the usability of keyboard navigation. - Users dependent on a keyboard for navigation have been forced to tab everywhere in the document, as the only keyboard accessible document elements are form and anchor elements. - This has forced developers to make most everything a link to make it keyboard accessible, and to get to each link you have to tab to it. - With the advent of portals and other content aggregation means Web pages are divided into visible regions and there has been no vehicle to get to them other than perhaps to do things such as:
-<H1>
tag There are number of problems with this approach:
-<H1>
to mark your regions, this is not consistent across Web sites - This remainder of this section provides the author with a playbook for using WAI-ARIA to add semantically rich navigation structure in a Web page so that an assistive technology may provide an effective user experience and avoid these shortcomings. -
-- - Due to the complexity of today's web content, it is imperative that all content reside in a navigation landmark. Sight and mobility impaired users must be able to quickly access a list of landmarks for a web page, to be used as a table of contents. - This allows the user to quickly navigate to important sections of the page without "endless" TAB navigation. If this is not done, then content will be orphaned and missed by the user. In fact many of today's accessibility test tools have built-in rules to flag this issue as a compliance error. This section defines how to create these navigable regions of the page:
-Identify the logical structure of your page
-Break up your page into perceivable block areas which contain semantically associated information called "regions". You can further break down each region into logical regions as needed. This is a common process undertaken by portal developers who break the page into perceivable regions called portlets. Think about the user wanting to navigate to these logical block areas on your Web page. Write down a description of what you believe each region to be.
-Depending on your Web application you may then need to break it into sub regions depending on the complexity of your Web application. This is a recursive process. A user will look at these perceivable areas like pealing an onion. You might have an outermost collection of perceivable regions or block areas and upon entering each region you may have a collection of regions within it.
-Implement the logical structure in markup
-Implementing the block structure in markup often involves wrapping elements contained with a "region" such as a <div>
or <iframe>
with visible borders so that each region or block is perceivable to the user.
Label each region
-Once you have broken up each region you need to label it. The start of each region must have a perceivable header and it should be used to label the region. For details on how to do this see section 3.4.3.1 Header Levels vs. nesting level to create a header to label each region. If you're finding it difficult to come up with a label for the region, make sure at least to use one of the standard roles defined in the following step. The drawback of not providing a label is that users will not know the purpose of the region. By definition, regions would be included in a summary of a page. If an assistive technology were to summarize it would be unable to provide information about the section without a label.
-Assign landmark roles to each region
-Now that you labeled your regions, you need to assign them semantic navigation landmarks. Landmarks are a vast improvement over the rudimentary "skip to main content" technique employed prior to WAI-ARIA. If possible it is best to use these as landmarks. Skip to main content links may impact the placement of web application elements. This may be a consideration for developers that want to try to keep their web application in a specific visible area. Consequently, layout adjustments may need to be made to support skip to main content links. Also, skip to main content links are limited in that they only address only one main content area. WAI-ARIA provides a collection of landmarks which are applied to each of the regions you identified in step 2.
-The presence of common, semantic, navigation landmarks allows each site to support the same standard and allows your assistive technology to provide a consistent navigation experience - an important feature for screen readers and alternate input solutions. For users with cognitive and learning disabilities the landmark information could be used to expand and collapse these regions of your page to aid in simplifying the user experience by allowing the user to manage the amount of information processed at any one time.
-WAI-ARIA landmark roles that are applied to elements having strong native semantics are not mapped consistently to the platform accessibility API. An example is the TABLE
element. For this reason, it is recommended that authors apply landmarks to DIV
and SPAN
containers.
There are also mainstream benefits of providing navigation landmarks. Your browser may assign key sequences to move focus to these sections as they can be set on every site. Navigation to these landmarks is device independent. A personal digital assistant (PDA) could assign a device key to get to them in your document. The common landmarks in WAI-ARIA include:
-If the entire web page has a role of application then it should not be treated as a navigational landmark by an assistive technology.
-To set a landmark in your page:
-<div role="navigation" title="Table of Contents"> … </div> -<div role="main" title="Game Statistics"> … </div>-
- If you have a regional landmark of type application and static descriptive text is available, then on the application landmark, include an aria-describedby reference to associate the application and the static text as shown here:
<div role="application" aria-labelledby="calendar" aria-describedby="info"> -<h1 id="calendar">Calendar<h1> -<p id="info"> -This calendar shows the game schedule for the Boston Red Sox. -</p> -<div role="grid"> -… -</div>-
You can create custom regional landmarks by using a generic region. While it is not essential to label these specialized regions with a header, you should provide a title to ensure that the region name is accessible to all users, just as you would the standard regional landmarks. See Header levels versus Nesting levels for directions on how to label the region.
-<div role="main"> … <div role="region" title="weather"> --
Note: the region role is generic and should only be used when a more specific role is not applicable.
-Indicate to the assistive technology who controls the keyboard navigation
-Today's screen readers for the blind have been designed to give the user a "browsing" experience meaning the screen reader consumes a number of keys to aid in the browsing experience. For example, the "up" and "down" arrow keys are used to read the next and previous line of text on your Web page. Accessible rich internet applications will use these keys in an application to navigate within "widgets" like a Tree View.
-Assistive technologies must be able to identify widgets which implement WAI-ARIA and allow them use of the keyboard. However, if you have used numerous widgets to form an application you must set the role on the encompassing region to application. Should you have regions which should be browsed as documents within the application region you should mark those regions with a document role as needed. See section 3.4.2 Structural Roles used to facilitate assistive technology navigation.
-When viewing Web content however, screen readers often gather information about all the widgets in an area and present them in a document-like view which the user navigates using keyboard commands provided and controlled by the screen reader. Think of this mode as a virtual environment that presents Web content in a way that makes it convenient for adaptive technology users to navigate and read. This is sometimes called browse mode, or virtual mode. We refer to this as "document browse mode."
-Because many screen readers provide document mode navigation support using single key mnemonics on the alpha-numeric keyboard, they may provide a third mode, called "forms mode," used to interact with form controls that are encountered in document mode. Behavior in forms mode is similar to that of application mode. The key feature of forms mode is that it can be toggled with document mode to make it easy to both interact with a specific widget, and read virtualized content of which the widget is a part. Since, as described above, a screen reader's perception of an area as either a document or an application greatly influences how the user reads and interacts with it, WAI-ARIA provides content authors a way to indicate whether their pages must be viewed as applications or documents by assistive technologies.
-To set document or application mode follow these steps:
-Set the Application Role
-After you have divided your Web page into regions through the use of role landmarks and custom regions, you must make a decision: Is your Web page an application or not? If the majority of the content is application-like the default interaction mode should be set to application, with document regions embedded within the application if applicable. Otherwise the default interaction mode is document-like and therefore should not be overridden by the use of a global role of application. In this case the application role can be placed on discrete regions within the document if applicable.
-If it is, set the role of application on the body tag as follows:
-<body role="application">-
When using application, all static text must be associated with widgets, groups or panes via using the aria-labelledby and aria-describedby properties, otherwise it will not be read by the screen reader when the user navigates to the related widget or group.
-Special Considerations:
-WAI-ARIA provides dialog and alertdialog roles that are to be treated as special case application roles. Like application, screen readers will leave the main job of keyboard navigation up the dialog.
-When using dialog, all static text must be associated with widgets, groups or panes using the aria-labelledby and aria-describedby properties, otherwise it will not be read by the screen reader when the user navigates to the related widget or group. Unlike an application, your Web page is unlikely to start out as either of these two roles but rather the author is most likely to dynamically create dialogs or alertdialog sections within the Web page.
-Unlike dialog, descriptive text of the alert does not need to be associated via a relationship, as the contents of alert dialogs will be read automatically by the screen reader when the dialog opens.
---The default mode for a screen reader to be processing an HTML Web page is document browse mode. This is equivalent to having a role of document on the HTML
-<body>
tag. If you have already specified a role of application on the body tag there may be times in which you tell the screen reader to switch into "document browse mode" and start stealing the necessary keys to browse a document section of your Web page. These keys are the typical keys used by WAI-ARIA widgets and to provide this level of navigation the keys must be stolen from your browser.To mark areas of your page to tell the assistive technology when to switch into document browse mode, look at the regions/landmarks you have defined and determine which ones must be browsed as a document or navigated as an application. For each region which must be browsed in document browse mode, embed a div element within it with the role of document as follows:
-<div role="document">-Now, when a screen reader encounters this region, it will change its interaction model to that of document browsing mode.
-
This section discusses the use of the heading role and nesting levels.
-The heading role value signifies a heading for a section of the document instance. Use of the heading role indicates that a specific object serves as a header. The region of the document to which the heading pertains to should be marked with the aria-labelledby property containing the value of the id for the header. If you have a heading and there is no element containing the content that it heads, wrap the content in a <div> bearing this aria-labelledby attribute. If headings are organized into a logical outline, the aria-level property can be used to indicate the nesting level. Here is an example with and without ARIA. Note that the preferred way is using native semantics without ARIA, but the approach with ARIA is shown first to demonstrate use of the heading role:
-Using ARIA: -<div role="main" aria-labelledby="page_title"> - <p id="page_title" role="heading" aria-level="1">Top News Stories</p> - … main page contents here … -</div> - -Using native markup: -<div role="main" aria-labelledby="page_title"> - <h1 id="page_title">Top News Stories</h1> - … main page contents here … -</div> --
Assistive technology briefs users on the context where they are. When they arrive at a new page, a page summary may be given. When they move into a new context, some of the labeling from elements containing the new focus or reading location may be rendered by the assistive technology, to give context to the details to be read next.
-The syntactic structure of a page provides the default nesting of contexts. If a paragraph is nested in a <div> or table cell, it is assumed that labels for the <div> or headers for the table cell are pertinent to what is in the paragraph. On the other hand, it is not possible to always flow the logical structure one-to-one into the parse structure.
-The aria-owns relationship is provided to annotate logical nesting where the logical child is not a syntactic descendant of the logical parent. In a Rich Internet Application, updates may be made to the document without updating the logical syntactic structure, yet elements may appear to be added to the document structure. From a DOM and accessibility hierarchy perspective aria-owns is a fallback mechanism to using the tree hierarchy provided in the DOM. An example of where aria-owns is needed is a treeitem, where children in a folder subtree are added to a visible subtree but not reflected in the actual document subtree of the folder. The aria-owns relationship can be used to associate the folder with the new "adopted" child. For more details on the use of aria-owns see section 4.2 Owning and Controlling. The aria-owns relationship is used to indicate to a user agent that a menu is an adopting parent of a sub menu. Another use for aria-owns is a hierarchical diagram where the child nodes of the diagram are not be adequately represented using the DOM structure.
-There are several WAI-ARIA roles used to indicate a collection of user interface objects, and each has a distinct purpose:
-The use of each is described below.
-The WAI-ARIA role, directory, allows authors to mark static table of content sections of a document. Prior to WAI-ARIA, the user would need to guess if an area of a document actually pertained to the table of contents. Authors should mark these sections within a document with a role of directory.
-<div role="directory"> - <ul> - <li>Global Warming Causes - <ul> - <li>CO2 Buildup</li> - <li>Auto emissions<li> - <li>Factory emissions</li> - <li>Destruction of rainforests</li> - </ul> - - </li> - - <li>Tailoring CO2 buildup - <ul> - <li>Elimination of the incandescent light bulb</li> - <li>Hydrogen fuel cells</li> - <li>Solar energy</li> - <li>Wind power</li> - </ul> - - </li> - </ul> - -</div>-
Authors should use a role of group to form logical collections of items with related functionality in a widget. A group should not be considered a major perceivable section on a page. A group neither has a heading nor appears in the "Table of Contents." A group may delineate a set of treeitems having the same level in the tree or it may be used to group a set of related checkboxes in a form. Other examples include:
-Proper handling of a group by assistive technologies, therefore, is determined by the context in which it is provided. Group members that are outside the DOM subtree of the group need to have explicit relationships assigned for them in order to participate in the group. Groups may also be nested.
-If an author believes that a section is significant enough in terms of the entire document instance, then the author must assign the section a role of region
or one of the designated standard landmarks. The designated landmark roles are listed in the section Regions and XHTML Role landmarks.
When defining a region for a section of a document, authors must consider using standard document landmark roles defined in the XHTML Vocabulary. This makes it possible for user agents and assistive technologies to treat roles as standard navigation landmarks. If the definition of these regions is inadequate, authors must use the WAI-ARIA region role and provide the appropriate title text.
-For more information on the use of region see Regions and XHTML Role landmarks.
--
A number of structural roles support the tabular widgets, grid and treegrid. These structural roles indicate additional keyboard navigation as well as the ability to select rows and/or columns. Typically, you would apply these roles to an underlying table in the base markup as shown here:
-<table role="grid">-
However, that may not work for the developer in all instances, such as when the developer has need for a <div> or <span> or when additional semantics are needed. To assist, the following roles are provided to support tabular widgets:
- -When constructing a grid or treegrid the author must use gridcells for the actual cells:
-<table role="grid"> - <tr> - <td role= "columnheader">Apples</td><td role= "columnheader">Oranges</td> - </tr> - <tr> - <td role="gridcell">Macintosh</td><td role="gridcell">Valencia</td> - </tr> -</table>-
Unlike table cells within a table, authors should ensure a grid's gridcells are focusable through the use of tabindex (in HTML), or aria-activedescendant on the grid.They may also be editable, as is shown in the above example.
-Treegrid's may require expanding and collapsing rows which may not be performed using a <tr>. In these instances authors will use an HTML <div>
. WAI-ARIA provides a role of row which may be assigned to the <div>
to convey to the assistive technology that this is still a row. If you decide to not use the native HTML <table> elements and choose more flexible elements, such as <div>
and <span>
s, with applied WAI-ARIA roles in this section, you should structurally lay out your elements in line with what you would expect from HTML. All of your rowheaders should be in a row and your gridcells should be children of each subsequent row in the same format as HTML for <td>
s and <th>
s within <tr>
s.
- A new feature of WAI-ARIA is the ability to associate descriptive text with a section, drawing, form element, picture, and so on using the aria-describedby property. The use case for aria-describedby is to reference the local id
of the long description. The most common use case for longdesc
is for the author to create a separate file to describe a picture. It is preferable to have the descriptive text in prose as well so that it is readily available to all users. This is useful for authors who do not want to create a separate document that contains the description, and for cognitively impaired users who can be confused by context changes when having to go to another page for the description. Yet, like longdesc
, descriptive text is treated separately from the short name provided by the title
or alt
attributes in HTML.
-
- The aria-describedby property allows for the text of hidden elements to be used for accessible descriptions. Some screen reader vendors have used non-standard attributes to provide hidden help text for form
elements. In order to standardize this feature, hidden text is exposed in the description property of Accessibility API objects when referenced by aria-describedby.
-
<img src="foo" alt="abbreviated name" aria-describedby="prose1"> - -<div id="prose1"> - The prose in this div describes the image foo in detail. -</div>-
This is the preferred vehicle for providing long descriptions for elements in your document.
-When the author does not desire the entire descriptive text to be located on the main page, aria-describedby can also be used to point to a link to another page.
-<div id="figuretitle">Figure 1-1: Entity Relationship Diagram showing EMP and DEPT</div> - <img src="foo" aria-labelledby="figuretitle" aria-describedby="link1"> - <a href="descriptionLocation.html" id="link1">Description of Figure 1-1: Entity Relationship Diagram showing EMP and DEPT</a> -</div>-
It is not good practice to use the above pattern when the describing element—the <a>
tag with @id='link1'
—is hidden, since there is no way for a user to navigate to and activate the link. Use the technique only when the description is not hidden.
In order to synchronize with the XHTML Role Attribute module, WAI-ARIA includes two XHTML roles which are neither landmarks nor widgets of any kind. These roles were incorporated to replace standard elements found in host languages. These roles are definition and note. If either role has a corresponding element in the host language, it is recommended that authors use the corresponding element in the host language.
-The definition role indicates a definition statement in your document. For HTML developers implementing lists of definitions, we recommend you using the DL, DT, and DD elements rather than marking an arbitrary element with a role of definition. An arbitrary element would be appropriate for inline definitions used in conjunction with the DFN element.
-Example of an inline definition with an explicit labelledby relationship:
--<p>The doctor explained it had been a <dfn id="placebo">placebo</dfn>, <span role="definition" aria-labelledby="placebo"> -an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span> -</p>-
Example of an inline definition with an implicit labelledby relationship determined by nesting:
-<p>The doctor explained it had been a <span role="definition"> -<dfn>placebo</dfn>, an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span> -</p>-
Note: In the case where host language semantics do not allow for implicit nesting of definitions terms inside definition roles, authors should explicitly use the aria-labelledby attribute, even when the definition term is nested in the definition as shown here:
-<p>The doctor explained it had been a <span role="definition" aria-labelledby="placebo"> -<dfn id="placebo">placebo</dfn>, an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span> -</p>-
The following is an example using a definition list:
-<dl> - <dt id="anathema">anthema</dt> - <dd role="definition" aria-labelledby="anathema">a ban or curse solemnly pronounced by ecclesiastical authority and accompanied by -excommunication</dd> - <dd role="definition" aria-labelledby="anathema">a vigorous denunciation : cursor</dd> -<dt id="homily">homily</dt> -<dd role="definition" aria-labelledby="homily">a usually short sermon</dd> - -<dd role="definition" aria-labelledby="homily">a lecture or discourse on or of a moral theme</dd> - -</dl>-
The note role defines a parenthetic or ancillary remark to the main content of the resource. It also allows assistive technologies to skip over this section of the document unless more information is requested about the main content.
-<div role="main" aria-labelledby="foo"> - <h1 id="foo">Wild fires spread across the San Diego Hills</h1> - Strong winds expand fires ignited by high temperatures … -</div> - -<div role="note"> - This article was last updated July 30, 2008 at 6:05PM. -</div>-
- MCK: Setting this content aside to determine whether we will remove or rewrite it. -
-- The Common Widget Design Patterns section of this document contains best practices, such as keyboard navigation, for creating common widgets found on the Web. - This section contains miscellaneous authoring practices that you should also consider. -
- -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:
-
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.
-
- MCK: unedited content pulled together from the old guide that needs a significant re-write. - Please ignore this section for now. -
- -- WAI-ARIA provides for two dialog roles - dialog and alertdialog. When authors simulate dialogs on a web page they often limit their interaction considerations to the mouse. - Unlike Graphical User Interface dialog boxes on a desktop computer, a user during keyboard navigation could accidentally navigate outside the dialog box and become disoriented. - This can happen when the user is tabbing in the dialog. - A modal dialog prevents the user from setting focus outside of the dialog until the dialog is closed. - Mouse clicks outside of the dialog must be ignored and the user must not be able to tab into or out of the dialog itself. - All WAI-ARIA enabled dialog boxes should be modal. - This section describes how. -
- -- Mouse clicks outside of the dialog can be prevented by creating a CSS positioned element that is the size of the viewport to append as a child of the body element. - Set the CSS z-index of this element so that it is above all other elements on the page except for the dialog element. - Set the tabindex of the underlay element to tabindex="-1" to prevent it from receiving focus via a keyboard event or mouse click. - You may lower the opacity of the underlay element in order to emphasize that the dialog itself is modal and has focus. -
- -- Depending upon the action to be performed by the dialog, the object with focus before the dialog box is opened should be saved. - This will allow restoring focus to this element when the dialog box is closed. - When the dialog box is opened, focus should be set to the first tab focusable element within the dialog. - If there is no tab focusable element within the dialog box contents, set the focus to the item that is used to cancel or close the dialog. - There must be some element within the dialog which can accept focus in order for the screen reader to speak the dialog title and information when it is opened. - In order to prevent keyboard focus from leaving the dialog, determine the first and last tab focusable elements in the dialog and trap keyboard events within the document. -
- -- Search the contents of the dialog container to find the first and last tab focusable elements. - This can be implemented by walking the DOM tree of the dialog container to find all visible and enabled anchor elements, input elements, and all elements that have a tabindex value greater than or equal to 0. - Remember that elements with a tabindex > 0 will appear in the tab order before all other focusable elements in ascending order by tabindex. - Store the first and last tab focusable items within variables in the scope of the dialog box code. -
- -- Before the dialog is shown, create and display the dialog underlay. - Connect an onkeypress event handler to the DOM document.documentElement. - This will catch all keystrokes on the document and allow trapping keyboard focus within the dialog. - Size and position the dialog box in the viewport above the underlay, make it visible and set focus to the first tab focusable item in the dialog box. -
- -- The onkeypress handler will catch all key presses within the document. - This onkeypress event handler should be within the scope of the dialog box code so that it has access to the first and last tab focusable elements within the dialog. - In the onkeypress handler determine the target of the keypress event. - In addition, determine if there is only a single focusable item within the dialog box. - In this instance the first tab navigable object will equal the last tab navigable object. - If key presses within the dialog box may create, destroy, enable, disable, or change the visibility of tab focusable elements, then determine the first and last tab-focusable items each time a keypress is received. - Based on the event target and the key pressed take the following actions: -
- -- Determine if the target node of the keypress is within the dialog box container. This can be done using a while loop to walk the parent chain of the target node until the container node of the dialog box is found. Other than those outlined above, all key presses from within the dialog box should be allowed to execute so that the user can interact with the controls in the dialog box. -
- -- If the target node is not within the dialog box, the keypress is from the documentElement and the keypress event should be stopped unless it is a Tab key press. Allowing a Tab key press from the document element will enable tabbing back into the dialog box if, for some reason, focus on the dialog box is lost. This can happen due to timing issues when the dialog box is first loaded and focus does not properly get set to the first tab-focusable item within the dialog. -
- -- The dialog box itself should contain buttons or other mechanisms to cancel the dialog box or execute the dialog box functions and close the dialog box. -
- -- Here is a pseudo code onkeypress handler for a modal dialog box. Pseudo code is used to focus on the actions in the handler rather than on the differences in browser event handling. Assume that the event object, evt, has been normalized between browsers and the helper object is a library of functions that handle browser differences. The keys object is a set of key definition variables. Dialog is the dialog box object, which has a function to cancel the dialog. -
- --_onKey: function(/*Normalized Event*/ evt){ -// summary: -// Handles the keyboard events for accessibility reasons -if(evt.charOrCode){ -var node = evt.target; // get the target node of the keypress event -if (evt.charOrCode === keys.TAB){ -// find the first and last tab focusable items in the hierarchy of the dialog container node -// do this every time if the items may be added / removed from the dialog may change visibility or state -var focusItemsArray = helper.getFocusItems(dialogContainerNode); -dialog.firstFocusItem = focusItemsArray[0]; -dialog.lastFocusItem = focusItemsArray[focusItemsArray.length-1]; -} -// assumes firstFocusItem and lastFocusItem maintained by dialog object -var singleFocusItem = (dialog.firstFocusItem == dialog.lastFocusItem); - -// see if we are shift-tabbing from first focusable item on dialog -if(node == dialog.firstFocusItem && evt.shiftKey && evt.charOrCode === keys.TAB){ -if(!singleFocusItem){ -dialog.lastFocusItem.focus(); // send focus to last item in dialog -} -helper.stopEvent(evt); //stop the tab keypress event -} -// see if we are tabbing from the last focusable item -else if(node == dialog.lastFocusItem && evt.charOrCode === keys.TAB && !evt.shiftKey){ -if (!singleFocusItem){ -dialog.firstFocusItem).focus(); // send focus to first item in dialog -} -helper.stopEvent(evt); //stop the tab keypress event -} -else{ -// see if the key is for the dialog -while(node){ -if(node == dialogContainerNode){ // if this is the container node of the dialog -if(evt.charOrCode == keys.ESCAPE){ // and the escape key was pressed -dialog.cancel(); // cancel the dialog -}else{ -return; // just let it go -} -} -node = node.parentNode; -} -// this key is for the document window -if(evt.charOrCode !== keys.TAB){ // allow tabbing into the dialog -helper.stopEvent(evt); //stop the event if not a tab keypress -} -} // end of if evt.charOrCode -} // end of function --
MCK: this section is a collection of keyboard related old content with a yet undecided fate.
- -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.
- 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. -
-- 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> - … --
It is essential that application vendors maintain a valid format for -aria-valuenow, and aria-valuenow should -accurately represent the value of the widget.The value must be within range of aria-valuemax and aria-valuemin, where the value of aria-valuemin is less than or equal to the value of aria-valuemax, throughout the life cycle of your widget. If aria-valuemin is not less than or equal to the value of aria-valuemax, or if the aria-valuemax is indeterminate, this creates an error condition that will be handled by -the assistive technology, resulting in undesirable results. Should an alternative text - equivalent be needed to properly represent the aria-valuenow, such as a day - of the week, then you should accompany the aria-valuenow with an appropriate - aria-valuetext equivalent such as in this example:
--<div role="slider" - aria-valuenow="1" - aria-valuemin="1" - aria-valuemax="7" - aria-valuetext="Sunday"> --
-Here the values 1 through 7 represent the days of the week and - aria-valuenow of 1 is equivalent to the first day of the week or Sunday. When aria-valuetext is made available aria-valuenow should also be treated as an index which is 1 based.
-This section has not been updated since it was integrated from APG version 1.0 -- an APG task force review is pending.
-Marked up content or widgets will often need additional context to make clear what the meaning or purpose is. It is also reasonable that some content media types will need additional descriptions in another format to give clarity to those who are unable to consume the origin format. These additional meta-content sections are linked together by tagging them as labels or descriptions. WAI-ARIA provides the aria-labelledby and aria-describedby attributes to signal the browser to feed these relationships into the accessibility layer. This layer is then used by screen readers and other accessibility technology (AT) to gain awareness of how disparate regions are actually contextually connected to each other. With this awareness the AT can then present a meaningful navigation model for discovery and presentation of these additional content sections. The user agent itself can also choose to present these insights in a meaningful way. Generally you should always add these attributes to any widgets on your site as they are often merely a construct of HTML and JavaScript which provides no obvious insight as to what the widget's behavior or interactivity is.
-<div>
and you need to associate a label for the dialog. With a WAI-ARIA role of dialog, you can indicate its widget type and define a label using an HTML header and then associate that label with the dialog using the aria-labelledby relationship.
- - <div role="dialog" aria-labelledby="dialogheader"> - <h2 id="dialogheader">Choose a File</h2> - … Dialog contents - </div> --
The section doing the labeling might be referenced by multiple widgets or objects as these need only reference the same id, so contextual description may not always be viable. The labelledby attribute can have multiple ids specified as a space separated list much like applying multiple classes to a single DOM object.
-The aria-labelledby property can be used to label all visual objects, however it should be noted that (X)HTML provides a @for
attribute on the label
element which is used to label form controls. Use this attribute where possible and valid. Because the aria-labelledby attribute accepts multiple IDREFs, it is recommended that authors use aria-labelledby for labeling elements that require more than one label string.
Some elements receive their label for embedded text content, but that is the exception.
-Often user agents will operate with images turned off for network performance reasons. In these situations, alt
text is provided in the place of the image. When the host language provides alternative text capability it is recommended that authors use the alternative text to support these situations and not use separate labeling as a replacement.
When one element describes another, use the aria-describedby attribute. An aria-describedby section provides further information about a given object or widget, which may not be intuitively obvious from the context, content or other attributes. For example, a fake window is a common widget used in Web applications and is often constructed using a div absolute positioned in a layer above other content. To simulate common window behavior look and feel there is often an X box in the corner which, when activated, dismisses the window widget. One common way to make this X box is to simply make a link whose content is an X. This doesn't give a non-visual user much to go on and belies the real purpose of the X link. To help we add more descriptive text stored elsewhere in the page like this:
-<button aria-label="Close" aria-describedby="descriptionClose" - onclick="myDialog.close();">X</button>- and then elsewhere in the HTML -
<div id="descriptionClose">Closing this window will discard any information entered and -return you back to the main page</div>- Like labelledby, describedby can accept multiple ids to point to other regions of the page using a space separated list. It is also limited to ids for defining these sets. In our contrived example we would also want a good labelledby section to fully explain what the window does and how closing will effect the task being worked on. If an object or widget lacks describedby the user agent or AT may try to extract information from the label or th tags, if present. The label and th tags have limited use in that they can only be applied to forms or tables, respectively. -
WAI-ARIA also defines the tooltip role to which aria-describedby may reference an author defined tooltip. The assistive technology can tell from the type of object describing the document element what the purpose of that element is. For example, a screen reader could announce the tooltip without the user having to wave the mouse over the element by following the describedby relationship to a document area with a tooltip role. The aria-describedby property is also useful for describing groups.
-Here is a code snippet showing a set of the tooltip:
-… - <div class="text"> - <label for="first">First Name:</label> - <input type="text" - id="first" - name="first" - size="20" - onfocus="tooltipShow(tooltip1);" - onblur="tooltipHide(tooltip1);" - onmouseover="tooltipShow(tooltip1);" - onmouseout="tooltipHide(tooltip1);" - aria-describedby="tp1" - /> - <div id="tp1" class="tooltip" role="tooltip">Your first name is optional</div> - </div> -…-
The aria-describedby
property is not designed to reference descriptions on an external resource—since it is an IDREF, it must reference an element in the same DOM document. This is different from the HTML longdesc
attribute, which accepts any URI. In general, the preferred pattern for WAI-ARIA applications is to include all relevant resources in the same DOM, But if you wish to reference an external resource with aria-describedby
, you can reference a link that in turn references the external resource. This requires the user to follow two steps, first following the aria-describedby
arc, then following the link, but does address the use case. The following example demonstrates this:
<p> - <img - src="images/histogram.png" - alt="Histogram of Blackberry tree heights" - width="40%" - aria-describedby="longdesc1" - /> -</p> - -<p> - <a id="longdesc1" href="blackberry-description.html" target="_description">Data for Blackberry Histogram</a> -</p>-
It is not good practice to use the above pattern when the describing element—the <a>
tag with @id='longdesc1'
—is hidden, since there is no way for a user to navigate to and activate the link. Use the technique only when the description is not hidden.
Two relationships expand the logical structure of a WAI-ARIA Web application. These are aria-owns and aria-controls . The aria-owns relationship completes the parent/child relationship when it cannot be completely determined from the DOM created from the parsing of the markup. The aria-controls relationship defines a cause-and-effect relationship so that assistive technologies may navigate to content effected by and changes to the content where the user is operating.
-In addition to WAI-ARIA role and state information, for a document element, -an assistive technology needs to convey its context. In -the case of a treeitem, it is important to know the parent (container), - which may provide a folder depth and the number of siblings in the folder. This containment hierarchy can often be determined by -the DOM tree, as it provides parent, siblings, and children for a given -document element. That said, the DOM hierarchy is rigid and non cyclical in -that each node may only have one parent. In some situations, a child -is reused by multiple parents or a child is separated from its -siblings or parent in the DOM tree. One example is when a radio button -appears in a table but it is not a DOM child of the radiogroup, due to the -authors use of a table for formatting and the placement of the radio buttons -placing them outside the radiogroup container. To solve this problem -WAI-ARIA provides the aria-owns property.
--The aria-owns property is set on a document element, and its values are the -unique IDs of all the adopted children. These elements may appear anywhere -in the DOM, yet they are treated as siblings of each owning parent. This -example illustrates a radiogroup that first uses the DOM hierarchy to -convey context and then aria-owns:
-First, consider the preferred method for using the W3C DOM to describe the relationship between - radiogroup and radio roles for HTML:
--<div id="radio_label">My radio label</div> -<ul role="radiogroup" aria-labelledby="radio_label"> -<li role="radio">Item #1</li> -<li role="radio">Item #2</li> -<li role="radio">Item #3</li> -</ul> --
-In this example, the elements with role="radio"
are child nodes of the parent role="radiogroup"
element node.
-
-
-Now, consider an alternative method using the aria-owns property to describe the parent-child -role relationship between radiogroup and radio roles for HTML:
--<table> -<tr> -<td role="radiogroup" aria-owns="myradio1 myradio2 myradio3" rowspan="3" > -My Radio Label -</td> -<td id="myradio1" role="radio">Item #1</td> -</tr> -<tr> -<td id="myradio2" role="radio">Item #2</td> -</tr> -<tr> -<td id="myradio3" role="radio">Item #3</td> -</tr> -</table> --
-The aria-owns property should be used sparingly, since it -increases the computational load on assistive technology to provide -alternative renderings. Also, when accessing the DOM and enumerating -children of a DOM node, an AT should then enumerate the adopted children -using the aria-owns property. At that instance of walking the DOM, the -parent of the adopted children is the adopted parent and not the DOM -parent. This will avoid recursion problems.
--Each child, adopted or natural, should have the appropriate - aria-posinset and aria-setsize properties set consistent with their -rendering, if these cannot be determined from the DOM from a direct parsing of -the host language. Places where direct parsing does not allow the user -agent to determine - aria-posinset and aria-setsize are long lists where only -the currently visible items are loaded (via Ajax). If the children are -re-sorted then the - aria-posinset and aria-setsize values should be updated -consistent with their visual rendering. Rather than setting size only on a container, content authors should specify aria-setsize on each member of a set to avoid performance issues. If this property is not set, the user agent must compute and set the property on supporting roles.
-Platform accessibility API mappings must invert this relationship for - assistive technologies, so that they may determine the owning parent from a - child and couple it with aria-posinset and aria-setsize information to - provide context information to the user.
-If you are re-using content across different, transient sections of content by restyling it to render it in association with a different object, you need to maintain the aria-owns property as well to match the current use and apparent ancestry of the reused sub-section. A good example of this is a context help menu that resides at the end of the document. When the user wishes to launch the context help menu in association with different visual elements, styling is used to render the menu in context with that object. Prior to rendering the visual submenu you should ensure the object to which you have requested help assigns its aria-owns property value to the submenu ID. When the menu closes you can remove the aria-owns property.
-In rich internet applications document elements may control the behavior on another part of Web page outside themselves. The aria-controls attribute indicates cause-and-effect relationships between document elements.
-An example might be a group of radio buttons that "control" contents of a listbox in another part of the page. Here, you would want the radio group to assign a aria-controls relationship to the listbox which will be updating without a page reload. The user, through their assistive technology, can then navigate to the listbox by following the aria-controls relationship when a different radio is selected, to see how the contents changed in the listbox. The ability to update parts of a page without a page reload is a common practice of applications making use of Ajax. Without the aria-controls attribute, a user would be unable to effectively use these types of Web pages as assistive technologies often will not make the user aware of what is happening outside the context of the element the user is currently operating.
-With the aria-controls attribute the user may use the assistive technology to follow the relationship to the object it is controlling. It is extremely important for an assistive technology to present changes in the document in response to user input. Therefore, an assistive technology immediately presents changes to a live region when the controlling widget is the one which has user keyboard focus. For example, if a tree view controls a help document pane, each time
- the tree item changes the new tree item and then the new help contents should also be read. In the case of a screen reader, the amount of information read in the target live region is dependent on how the live region is configured.
The aria-controls attribute takes one or more ids which refer to the document element. If this relationship is not implied by the host language semantics, then the controlling element must be given a controls attribute with the IDs of the other elements where the changes will show up listed in the attribute value.
-(X)HTML suffers from a number of disadvantages in keyboard navigation today. One such example is the restriction of navigation to the tabbing order. This is a common problem with presentations in office suites where the logical, perceivable, navigation order of a slide may not match the tabbing order. Sighted users may see a logical navigation process (such as visual steps in the process for assembling a lawn mower). This "flow" is not conveyed by the tab order. The user might tab from step 1 and land on step 4. Another problem is the construction of model-based authoring tools on a Web page. In a model-based authoring tool, a visual object may provide a number of paths that the user can take, such as a multiplexor, which may have output that logically flows to a number of optional electronic components in a drawing. In Web 2.0, developers are actually creating drawings like this to perform tasks such as visually model a work flow. In this scenario, the user will want to decide which object they will navigate their screen reader or alternate input device to next.
-Although it is recommended that Tab order follow the reading flow, there may be instances where this is not possible. For these reasons, WAI-ARIA provides a relationship property, called aria-flowto. This allows the author to provide an assistive technology with alternative navigation flows through the document that best represents the author's intent and which is more logical for people with disabilities. aria-flowto establishes the recommended reading order of content, so that the an assistive may overriding the default of reading in document order to its user. aria-flowto does not change the keyboard navigation order of the browser.
-Consider the first case of changing a basic reading flow to circumvent (X)HTML tabbing. A good example of this is a logical reading flow in a portal with landmarks. In the future, the user may wish to change the reading flow based on the order of priority with which they navigate a personalized Web application. In the following example, the navigation would follow the order of "Top News Stories", "television listings", "stock quotes", and "messages from friends" by following (X)HTML document reading order. However, the author or end user may determine that the main content is most important, followed by "stock quotes", "messages from friends", and then "TV listings." The end user can change the order if the web page or assistive technology provides an interface for such personalization.
-<html> -… -<div role="main" title="Top News Stories" id="main" aria-flowto="stock"></div> -<div role="complementary" title="television listings" id="tv"></div> -<div role="complementary" title="stock quotes" id="stock" aria-flowto="messages"></div> -<div role="complementary" title="messages from friends" id="messages" aria-flowto="tv"></div>-
The second use case is such that the Web developer may wish to circumvent the flow by branching to multiple paths in the Web page, requiring the assistive technology to present a collection of options where the user could go next. This is important for work flows or business process management applications. More of these applications are becoming Web based, and a vehicle is required to tell the user how to get through the work flow. The flowto property takes multiple idrefs, allowing the author to define each object the user could flow to. To implement this technique do the following.
-Make each object in the work flow accessible
-This will require assigning a title or WAI-ARIA label for each object and a unique HTML id. Also, if the html element is repurposed assign it a WAI-ARIA role.
-<html> - -… -<img src="foo.jpg" id="331" title="What is the Invoice Value?"> -<img src="foo.jpg" id="333" title="Finance Manager Approval"> -<img src="foo.jpg" id="334" title="Sales Manager Approval"> -…-
For each visual object that will flow to one or more other objects assign the flowto property the list of IDs to which it flows.
-<html> -… -<img src="foo.jpg" id="331" title="What is the Invoice Value?" aria-flowto="333 334"> -<img src="foo.jpg" id="333" title="Finance Manager Approval"> -<img src="foo.jpg" id="334" title="Sales Manager Approval"> -…-
Each element referenced by the flowto must have a unique id. The combination of the unique id and the name allow the assistive technology to adequately assist the user in retracing their steps backward through a flow to reference or moving forward to it. Since the author sets only the target the user agent is responsible for mapping the backward reference relationship. Therefore, neither the user agent nor the user can get lost. The host user agent does not provide an alternative navigation order; this is an assistive technology function.
-Use tabindex to enable objects to receive focus. Actually setting focus to them may be performed by an assistive technology, such as an alternative input device. This example places each drawing object in document order with respect to the tab sequence.
-<img src="foo.jpg" id="331" title="What is the Invoice Value?" - aria-flowto="333 334" tabindex="0"> -<img src="foo.jpg" id="333" title="Finance Manager Approval" tabindex="0"> -<img src="foo.jpg" id="334" title="Sales Manager Approval" tabindex="0"> -…-
When an assistive technology encounters "What is the Invoice Value?," it will know to tell the user that they may choose to navigate either to the "Financial Manager Approval" or to the "Sales Manager Approval" object. The options may be provided through a menu for the What is the Invoice Value object by the assistive technology. After a choice is made, then the AT can move focus to the target object; or in the case of a screen reader, it may just move the user to that location in the screen reader's virtual buffer.
-Note: WAI-ARIA does not specify backward flowto properties for the same reason that we do not have the reverse of relationships like labelledby. The author may incorrectly do the reversal, creating a whole set of new problems. Rather, the task of the reversal relationships may be handled by the user agent through its accessibility API mapping or in the assistive technology itself.
-In order for menus, menubars, and menuitems to indicate that it opens a menu, set its aria-haspopup property to "true." The type of menu being launched (submenu, context help, etc.) is not explicitly indicated with WAI-ARIA but is based on the operational characteristics (keyboard and mouse commands).
-Combo boxes, or drop down lists, work differently. Controls with the role combobox must contain a list of items that can be opened, usually as a drop-down. Because this is intrinsic to the functionality of a combo box, it does not need to be explicitly indicated with aria-haspopup.
- -The following html fragment shows the use of aria-haspopup with a menubar, its menus, and submenus. All of the menuitems associated with the menubar have aria-haspopup set to 'true'. Also, the "Zoom" menuitem of the "View" menu has an aria-haspopup property as it leads to a submenu.
- -<div role="menubar"> - <!-- - File menu: File menuitem has an aria-haspopup attribute set to 'true'. - That popup div follows immediately below. - --> - <div role="menuitem" aria-haspopup="true" id="fileMenu">File</div> - <div role="menu" aria-labelledby="fileMenu"> - <div role="menuitem">Open</div> - <div role="menuitem">Save</div> - <div role="menuitem">Save as …</div> - … - </div> - <!-- - View menu: - --> - <div role="menuitem" aria-haspopup="true" id="viewMenu">View</div> - <div role="menu" aria-labelledby="viewMenu"> - <div role="menuitem">Normal</div> - <div role="menuitem">Outline</div> - <!-- - The View's Zoom menuitem has aria-haspopup='true' as it leads to a - submenu. - --> - <div role="menuitem" aria-haspopup="true" id="zoomSubMenu">Zoom</div> - <div role="menu" aria-labelledby="zoomSubMenu"> - <div role="menuitem">50%</div> - <div role="menuitem">75%</div> - <div role="menuitem">100%</div> - <div role="menuitem">150%</div> - <div role="menuitem">200%</div> - </div> - </div> -</div>-
This section has had only minor edits since it was integrated from APG version 1.0 -- a complete APG task force review is pending.
-General rules for managing content and displaying information
-display
property to WAI-ARIA hidden state. This is important for assistive technologies who communicate directly with the user agent's DOM versus a platform accessibility API supported by the user agent. You can also tie CSS visibility:hidden
or visibility:collapse
to the WAI-ARIA hidden state but the use of visibility:hidden
will affect layout in that content will continue to flow around the hidden area even though the content to be hidden is invisible. If you are refreshing areas asynchronously, then you need to designate live regions. The following sections explain how to implement live regions and when to use roles that are considered "live" sections by default, including alert, status, or log.
-Live regions are parts of a Web page that the author expects to change. Examples of live regions include dynamically updated content (sports stats, stock information), logs where new information is being added (chat transcript logs), notification areas (status, alerts), etc.
-Live regions enable assistive technologies, such as screen readers, to be informed of updates without losing the users' place in the content. Live region settings provide hints to assistive technologies about how to process updates. Note that the assistive technology is responsible for handling these updates and enabling users to override these hints.
-The section on Live Region Properties and how to use them gives the details of how to apply live region properties. This process will help rich internet application (RIA) developers to set live region settings that will provide a good user experience for most assistive technology users with little configuration on their part. When applying these live region properties, it is recommended that you conduct user testing. If the AT supports scripting of the response to live regions you may wish to customize the response, such as through a screen reader script for your Web page.
-Identify the live regions
-Live regions are any region on a page that receives dynamic updates through client-side scripting. Note the regions of your page that will be live.
-See if any of the special case live regions meet your needs
-WAI-ARIA provides a number of special case live region roles whose live region properties are pre-defined and which you may use. If one of these live region roles meet your needs just apply the specific role to the region of the Web page.
-Decide the priority of each live region
-When a live region changes, should the user be notified of the change? Notifications could include a sound for a screen reader user. (For simplicity, we will use the case of an audio notification in this discussion.) The shorter the interval between changes and the less important the information, the less likely that the user needs to hear every change. A simple example of changes that should not be heard are changes to time; a sound for every second would be very annoying.
-If the user should hear the change, should the change be announced immediately, as soon as possible, or only when the user is idle? Announcing a change immediately can be disorienting for users, so that should be done sparingly. Most updates should probably only be announced when the user is idle.
-After you have decided the priority for each live region, then decide the live property value:
-aria-live="off"
aria-live="polite"
aria-live="assertive"
Decide how much context is needed for each update
-When part of a live region changes, how much context is needed to understand the change. Does the user need to hear the entire live region or just the change by itself?
-If the user needs to hear the entire live region, then mark the entire live region with aria-atomic="true".
-Decide what types of changes are relevant for each live region
-Three possible types of changes are: additions, removals, and text. Additions means new nodes are added to the DOM; removals means nodes are removed from the DOM; and text means changes are solely to the textual content. Should the user hear all types of changes or only certain types?
-By default, the user will hear additions and text type changes. If you wish to explicitly define the types of changes, you need to set relevant="THE_TYPES_OF_CHANGES". If more than one type of change is relevant, the types are separated by a space. For example, to define additions and removals as relevant but not text, set relevant="additions removals".
-One of the most important concepts behind live regions is politeness. Politeness indicates how much priority a live region has. The following politeness values are available for aria-live: off, polite, and assertive.
-There are times to suppress AT presentation changes while a region is updating. For that you can use the aria-busy property.
-To suppress presentation of changes until a region is finished updating or until a number of rapid-fire changes are finished, set aria-busy="true" and then clear the attribute when the region is finished. While it is busy, the AT will track and collate the changes. It will finally speak the changes once the region is no longer busy.
-When a live region is updated, the update can often be announced on its own and still make sense. For example, if a news headline is added, it would make sense to simply announce the headline. However, sometimes the entire live region must be read in order to give the user enough context to make sense of the update. For example, it would not make sense to only give the current value of a stock without saying the name of the stock. The atomic setting gives assistive technologies a hint about which of these cases an update falls into.
-aria-relevant="removals"
or aria-relevant="all"
should be used sparingly. Notification of an assistive technology when content is removed may cause an unwarranted number of changes to be notified to the user. alt
attribute of images. This example shows two live regions. If both regions update simultaneously, liveRegionA should be spoken first because its message has a higher priority than liveRegionB.
---<div id="liveRegionA" aria-live="assertive"> -</div> -<div id="liveRegionB" aria-live="polite> -</div>-
You may wish to use a special live region role instead of applying live region properties. WAI-ARIA contains a number of standard roles which are by default considered "live" sections of your Web page. It is important to know when to use these and when to create a custom live region on your known. Here are some rules of thumb:
---alert - You may use the alert role for a one-time notification which shows for a period of time and then goes away. It is intended to alert the user that something has happened. The assistive technology should be notified by the user agent that an alert has occurred, if your operating system supports this type of event notification. When choosing to use alert you should use the alertdialog role instead if something inside the alert is to receive focus. Both alert and alertdialog usually appear to pop-up to the user to get their attention. Unless specified otherwise an alert region has an implicit aria-live of "assertive" and aria-atomic of "true".
-status - You may use the status role when you want to mark an area which is updated periodically and provides a general status of your Web application. Many applications provide status widgets and they are often found, visibly, at the bottom of the application and contain a variety of widgets within it to convey status. Unless specified otherwise a status region has an implicit aria-live of "polite" and aria-atomic of "true".
-timer - You may use a timer role when you want to mark an area which indicates an amount of elapsed time from a start point, or the time remaining until an end point. The text encapsulated within the timer indicates the current time measurement, and is updated as that amount changes. However, the timer value is not necessarily machine parsable. The text contents MUST be updated at fixed intervals, except when the timer is paused or reaches an end-point. The timer role has an impicit aria-live of "off".
-marquee- You may use a marquee role when you need to mark an area with scrolling text such as a stock ticker. The latest text of the scrolled area must be available in the DOM. A marquee behaves like a live region, with an implicit aria-live property value of "off."
-log - You may use log if you have a live area where new information is added, like a scrolling chat log of text. Unlike other regions, implied semantics indicate the arrival of new items and the reading order. The log contains a meaningful sequence and new information is added only to the end of the log, not at arbitrary points. Log has an implicit aria-live of "polite"If you have a chat text entry area you should indicate that it also controls the aria log aria like so:
-<div contenteditable="true" role="log" id="chatlog"> -</div> - - -<label id="gettext">Send Text</label> -<div aria-controls="chatlog" - role="textbox" - contenteditable="true" - aria-labelledby="gettext"> -</div-live region - If you have some other live area use case, WAI-ARIA allows you to mark an area using the aria-live attribute. This, accompanied by the collection of attributes which support the live property, allows you to create your own custom live area on your Web page. For more details regarding live regions refer to the live region section of this guide.
-
Live region roles that are applied to elements having strong native semantics are not mapped consistently to the platform accessibility API. An example is the TABLE
element. It is recommended that authors apply live regions to DIV
and SPAN
containers. For example:
<!-- Live region 'log' role used with TABLE element: the 'log' role is not consistently mapped to platform AAPI. --> -<!-- Do not use. --> -<table role="log" … > - … -</table> - -<!-- Wrap the TABLE element in a DIV with role 'log' instead: --> -<div role="log" … > - <table … > - … - </table> -</div> -- -
This section has not been updated since it was integrated from APG version 1.0 -- an APG task force review is pending.
-This section describes the presentation role, including the conditions under which it is inherited by an element's children.
-Authors devote a good deal of effort to the appearance of their web pages, and this is especially true in the case of scripted web applications. To this end authors employ various elements purely for visual presentation. For example, <img>
elements are used for spacing and decoration; and <table>
s are used to create a column based layout. Elements used strictly for presentation are semantically neutral and irrelevant in terms of accessibility. It is necessary to mark such elements as presentational so that they do not appear in the accessible tree created by the user agent. For example, a current technique used with spacer images is to provide blank alt
text to indicate that the image is not meaningful. User agents will not publish any information about images with blank alt
text to the platform accessibility API.
There are elements other than <img>
and <table>
that are used solely for visual presentation. Any element is a potential candidate for presentation, and, if so used, these elements also need to be marked as semantically neutral.
It is important to separate content and presentation. CSS 3 has introduced new table layout functionality to allow a user agent to layout content using CSS. There are many advantages to using this feature of CSS such as browser style sheet caching and improved adaptability to mobile devices with limited screen real estate. There are, however, cases where presentational markup cannot be avoided. In such instances, authors are counseled to consult WCAG 2.0 for more detailed guidance.
-WAI-ARIA introduces the presentation role as a general device for marking elements as presentational. The presentation role overrides the element's native implicit role, and informs the user agent to not publish the element to the accessibility API. In fact, the preferred way to mark <img>
elements as decorative is to use a role="presentation"
attribute instead of (or in addition to) an empty alt
attribute. Here is a code fragment sample:
<!-- [role="presentation"] informs the user agent that the spacer images are for layout only. --> -… -<h2>Other Histories of Architecture</h1> -<p> - <a href="www.somewhere.com">Ancient Roman Architecture</a> - <img src="spacer.png" role="presentation"> - <a href="somewhere.else.com">19th Century Italian Architecture</a> - <img src="spacer.png" role="presentation"> - <a href="www.elsewhere.com">Modern Buildings more than 100 Years Old</a> -</p> - -<h2>Modern Building Design</h1> -… --
The resulting accessible tree is shown below. Note that none of the spacer <img>
elements are present:
In general, the presentation role is not inherited by an element's children. The exceptions are elements whose role entails that the element has required owned children. Examples include the <table>
element and list role, and these exceptions are discussed further below. For all other elements, only the element marked presentational is eliminated from the accessible tree. Note, however, that its contents are published; in particular, the element's textual content is published, but any attributes of the element that may form a text-equivalent are not. For example, a header element with a presentation role would not appear in the accessible tree, but its text does. An image with a role of presentation is not exposed in the accessible tree, nor is the contents of its alt
attribute. This is shown in the following code fragment:
<!-- 1. [role="presentation"] negates the implicit 'heading' role semantics but does not affect the contents. --> - -<h1 role="presentation">Presentation role overrides Header role</h1> -<h1>Another header</h1> - -<!-- 2. [role="presentation"] hides the image from the accessibility API and does not publish the alt attribute contents. --> - -<img role="presentation" alt="This text will not appear in the Accessibility API" src="…"> - --
The first header element is absent from the accessible tree for the above example, but its text appears. The second header element is present as a heading. The img
element is not exposed at all:
Be aware that the markup <img role="presentation" alt="non-empty alt text"…>
is in fact contradictory: Declaring a role of presentation says that the image is for layout, is decorative and meaningless, whereas the non-empty alt text implies that the image is meaningful. It is recommended that authors instead use empty alt
text (alt=""
) where they use role="presentation"
.
Earlier it was noted that the presentation role is not generally inherited by an element's children. The exception are roles that have required owned elements. Examples include the <table>
element, and the list and tree roles. A list is required to have listitem children; a tree, treeitem children. The <table>
element's child components are <tbody>
, <thead>
, <tfoot>
, <th>
, <tr>
, <td>
, and <caption>
. These component elements would not appear in the markup without the enclosing <table>
root element. Thus, when a table is used for layout, it follows that all of its component elements are present in the markup for layout as well. Since annotating all the required child elements with role="presentation"
is error prone and difficult to maintain, it is sufficient to mark the table root element as presentational. The presentation role propagates to all the table component elements. However, as before, the contents of the table elements do appear in the accessible tree. Here is an example:
<!-- Layout table marked with [role="presentation"]. --> - -<table role="presentation"> - <tbody> - <tr> <td>Some text</td> <td><p>Paragraph</p></td> </tr> - <tr> <td><a href="www.somewhere.com">Link text</a></td> <td><img src="meaningful.jpg" alt="meaningful image"></td> </tr> - </tbody> -</table> --
All table specific elements (table, tr, td, etc.) are eliminated from the tree by inheriting the presentation role, but other elements and textual content in the table cells are exposed:
-The same logic applies to other roles that have required owned children, such as a list. If the list's root element is declared presentational using role="presentation"
, all of its listitem elements inherit the presentation role, and none of the list item elements appear in the accessible tree. However, the contents of each list item, that is, other elements and textual content, are included in the tree.
The presentation role is overridden in some circumstances. Recall that the presentation role informs user agents that certain elements are semantically neutral, and are irrelevant for accessibility. If, however, there is an aspect of an element that makes it meaningful, it is no longer neutral, and cannot simultaneously be presentational. The Core Accessibility API Mappings describes the cases where this occurs:
-<td>
, within a <table role="presentation">
, where that cell is marked with a button role: <td role="button" …>
-- the cell has a role of button, not presentation.
- These situations entail that the given element is semantically relevant and will appear in the accessible tree. Marking the element with a role="presentation" is an error, and user agents will ignore the presentation role in these cases. Authors are advised to not mark an element with a role of presentation when it has any of the above properties; rather, to use a role that reflects the element's purpose.
-This section has not been updated since it was integrated from APG version 1.0 -- an APG task force review is pending.
--This section identifies authoring practices for elements used as form elements. -
--Until the introduction of WAI-ARIA's aria-invalid state and aria-required property, only presentational strategies have been available to Web content authors to indicate that certain form fields and controls are required or invalid. In applications, these states are only available through styling or varying markup, which is inconsistent, and therefore is inconclusive. In Web-based forms, fields required may be marked by an asterisk. Forms submitted with required data missing or improperly specified may be redisplayed with the unacceptable elements highlighted in red. The assistive technology user is poorly served by such imprecise methods, and all users confront inconsistent indicators for consistent situations. -
--The WAI-ARIA invalid state and required property provide: -
-When a text input field that has a maximum length value (or the host markup language's equivalent) receives focus, the value defined for -"maximum length" should be communicated to the user. When text entry reaches that maximum length (or the markup language's equivalent), an alert (expressed in accordance with user preferences and capabilities) should inform the user that the maximum length for a given field has been reached. Such an alert can be expressed programmatically or, using as an aural icon, by using a WAI-ARIA alert; the user agent may alert the user through a system beep and by triggering the operating systems' "show sounds" facility. When maximum length (or the markup language's equivalent) is reached, the user must then be able to move to another form field in a manner consistent with tab-navigation for that document.
-Having a user agent automatically change focus in a form in response to user input can be advantageous in situations where that change saves the user keystrokes or on-screen keyboard interaction in order to manually move the focus from one field to another. However, as with form auto-completion, this type of text input event must be firmly under user control because this may not have been the user's intention and some users with disabilities may become disoriented such as those with sight impairments. Consider these cases:
-Use caution when using automatic submission of a form without explicit user command or -in response to a user-defined setting that permits such behavior, as -expressed by the Priority 1 UAAG 1.0 Checkpoints - 7.1, - 7.2 and - 11.1. -Unless the user has specifically chosen to set the user agent to allow auto-submission, authors are advised not to set onChange or onFocus events either to trigger submission of a form or to provide an auto-submission event upon -completion of all or all required fields of a form or input -field.
- -This section has not been updated since it was integrated from APG version 1.0 -- an APG task force review is pending.
-Editors' note: This section was added as part of disposition of comment 4, but is very incomplete. The section needs to be reordered, so that instructions on how to use the math role properly appear before considerations of legacy content and negative examples (such as the use of generic HTML to approximate a visual representation of a mathematical expression). It needs more introductory text about how to use math. The examples need better introductions, and the positive examples should preceded the negative examples, which need to be explained more fully.
-There exists significant amounts of legacy content that uses images - and/or textual approximations to represent mathematical expressions. - Examples of this include the use of ASCII art and/or the misuse of - HTML tags -- in particular, SUB and SUP -- to achieve a visual - approximation of a mathematical expression, one which is void of - the structure needed to render mathematical expressions inherently - meaningful.
-Use of generic HTML to approximate a visual rendering - of a mathematical expression:
-<i>a</i><i>x</i><sup>2</sup> + <i>b</i><i>x</i> + <i>c</i> = 0
Accessible example of the same function, using the math role, appropriate label, and MathML rendering:
-<div role="math" aria-label="a times x squared plus b times x plus c equals 0"> - <math xmlns='http://www.w3.org/1998/Math/MathML'> - <mrow> - <mrow> - <mrow> - <mi>a</mi> - <mo>⁢ <!-- invisible times --></mo> - <msup> - <mi>x</mi> - <mn>2</mn> - </msup> - </mrow> - <mo>+</mo> - <mrow> - <mi>b</mi> - <mo>⁢ <!-- invisible times --></mo> - <mi>x</mi> - </mrow> - <mo>+</mo> - <mi>c</mi> - </mrow> - <mo>=</mo> - <mn>0</mn> - </mrow> - </math> -</div>-
Similarly:
-
-<i>f</i>(<i>x</i>)
- = <i>x</i><sup>2</sup> + <i>x</i> - 2
-
Accessible example of the same function, using the math role, appropriate label, and MathML rendering:
-Todo: add aria-label here also
-<div role="math"> - <math xmlns='http://www.w3.org/1998/Math/MathML'> - <mrow> - <mrow> - <mi>f</mi> - <mo>⁡</mo> - <mrow> - <mo>(</mo> - <mrow> - <mi>x</mi> - </mrow> - <mo>)</mo> - </mrow> - </mrow> - <mo>=</mo> - <mrow> - <msup> - <mi>x</mi> - <mn>2</mn> - </msup> - <mo>+</mo> - <mi>x</mi> - <mo>−</mo> - <mn>2</mn> - </mrow> - </mrow> - </math> -</div>-
aria-grabbed and aria-dropeffect have been deprecated in ARIA 1.1 - as such this section has been removed. Advice for implementing drag and drop will be added to a future version of the Authoring Practices Guide.
- -This section has not been updated since it was integrated from APG version 1.0 -- an APG task force review is pending.
-Rich internet applications are complex to author. To save time, it is often faster to use existing widget libraries that implement WAI-ARIA and that have already gone through:
-Some publicly available UI component libraries have already implemented WAI-ARIA. Authors can reuse such libraries to start developing accessible rich internet applications.
-This section has not been updated since it was integrated from the ARIA 1.0 Primer -- an APG task force review is pending.
-According to the SecuritySpace Technology Penetration Report, more than 55% of all Web sites today contain JavaScript, dramatically affecting the ability for persons with disabilities to access Web content. New Rich Internet Applications (RIAs) render custom widgets, modeling rich desktop components to perform UI updates without having to reload the entire page - much like a graphical user interface (GUI). Legacy GUI accessibility frameworks address these issues through a comprehensive accessibility application programming interface (API) and infrastructure to foster interoperability with assistive technologies. These APIs constitute a contract between applications and assistive technologies, such as screen readers, to enable them to access rich dynamic content with the appropriate semantics needed to produce a usable alternative. No such contract exists between modern RIAs and assistive technologies, creating an accessibility gap for persons with disabilities.
-Unfortunately, HTML and other markup languages do not provide adequate - support for accessible dynamic content. Until now, the W3C WAI has discouraged the use of JavaScript per [[WAI-WEBCONTENT]], Checkpoint 6.1). - A - number of W3C initiatives underway address this problem using - a declarative markup approach. This primer describes a means to - bridge the interoperability problem with assistive - technologies now by incorporating the appropriate metadata into - current HTML and XHTML markup to support today's accessibility APIs. Moreover, the primer provides web developers with a conceptual understanding of WAI-ARIA as a prelude to using the [[WAI-ARIA]]. WAI-ARIA brings advanced accessibility features of the desktop to the web through the creation of cross-cutting technologies that - (X)HTML authors can incorporate in their markup. WAI-ARIA defines roles, states, and properties, where those roles reflect standard GUI elements that are recognized by accessibility Application Programming Interfaces (APIs). These metadata that describes these - GUI widgets and document structures aides assistive technology - vendors in providing accessible, usable solutions. The W3C WAI PF working group is working with User Agent manufacturers, assistive - technology vendors, and accessibility tool providers, to ensure an end-to-end working solution.
-For an introduction to WAI-ARIA, see the Accessible Rich Internet Applications Suite (WAI-ARIA) Overview. The WAI-ARIA Primer is part of a set of resources that support the WAI-ARIA specification. The Primer provides a basic introduction to the concepts behind and reason for WAI-ARIA, and the WAI-ARIA Authoring Practices describe recommended usage patterns for Web content developers. The WAI-ARIA Suite fills gaps identified by the [[WAI-ARIA-ROADMAP]]. These documents serve as important places of clarification where topics appear to be unclear.
-Aspects of traditional Hypertext Markup Language (HTML) make accessible support of dynamic content difficult:
-Authors of JavaScript-generated content do not want to limit themselves to using standard tag elements that define the actual user interface element such as tables, ordered lists, etc. Rather, they make extensive use of elements such as DIV
tags in which they dynamically apply a user interface (UI) through the use of style sheets and dynamic content changes. HTML DIV
tags provide no semantic information. For example, authors may define a DIV
as the start of a pop-up menu or even an ordered list. However, no HTML mechanism exists to:
DIV
as a pop-up menu In short, JavaScript needs an accessibility architecture to write to such that a solution can be mapped to the accessibility - frameworks on the native platform by the user agent.
-The following diagram illustrates a typical document object model (DOM) node in - a Model-View-Controller architecture. Accessibility information surfaced to assistive technologies is provided only by the HTML element's tag name, with only the accessibility attributes that tag can provide.
-shows that on the node, data, or the - "Model", which should include semantic information, is separated - from the user interface presentation, the "View." Here, the - document element is managed by the user agent based on the default - behavior of the element. The user agent's default behavior at the - document element forms the controller.
-The box between the DOM node
- and the assistive technology contains the contract
- provided by the user agent to the assistive technology. This data
- includes typical accessibility information found in the
- accessibility API for many accessible platforms for GUIs
- (role, state, caret, selection, text, hypertext, name
- description, parent/child information, parent/child
- information, and relations). For HTML and other W3C markup, the
- accessibility information provided solely depends upon what the element's tag name and any accessibility attributes that map to that tag provides. For example, the accessible role of a table is table
. The author provides an accessible description by assigning a title
attribute.
In contrast, with JavaScript, user actions can trigger updates in the data and presentation, but the default accessibility information available in the element tags is no longer valid.
-shows the same DOM node provided - in Figure 1.0 but with JavaScript acting as the new controller. - JavaScript overrides the default user agent behavior at the DOM - node. It manipulates the data, content, and style in response to - events caused by user interaction to produce custom widgets. In - this situation, the default accessibility information is no longer - valid and, therefore, the contract is now invalid. Figure 2.0 shows - the contract with asterisks in front of role, state, actions, - value, event changes, and relations. These asterisks represent - potential accessibility errors and gaps in the base markup. These - gaps result from the author's inability to provide the new semantic - data needed to support the contract.
-Any solution to facilitate the creation of accessible rich Internet applications (RIAs) must:
-What is clear from the problem statement is that developers of dynamic web content cannot provide the appropriate accessibility information in the markup to support the accessibility APIs on the target platform. This problem is not limited to HTML. It extends to other markup, including Scaleable Vector Graphics [SVG]. This primer addresses the problem for web content delivered to desktop browsers and introduces you to common extensions to both HTML and XHTML called [[WAI-ARIA]]. The goal is to make these standard features in HTML 5.
-Using as a template for addressing the - problem and U.S. Section 508 accessibility standards, Table 1.0 illustrates gaps - in the infrastructure and identifies W3C standards that should be used to - address the problem. In the right column, table cells that are empty - or that indicate a limitation represent accessibility gaps in HTML - and XHTML.
-Required Components | -Who does what today? (HTML) | -
---|---|
Events: | -- |
FocusChange | -DOM 2, 3 events | -
Activation | -User Agent API | -
Caret Change | -User Agent API | -
Value Change | -- |
State Change | -- |
Selection Change | -User Agent API | -
Mutation | -DOM Events | -
Accessible - Actions: | -- |
Event Handler functional information to label the actions | -- |
Access to the available event - handlers for enumerating the actions | -- |
State Information: | -- |
Role Information: | -Limited to standard HTML tag names. (Mix - Content/presentation) | -
Relationships: Parent/child | -Limited DOM (affected by style) (Mix Content/presentation) | -
Relationships: (Label, MemberOf - Group, - ControllerFor) | -Limited to HTML (Title, alt, label) | -
Text | -Core DOM from parsed HTML | -
Content selection: | -Browser-dependent (incomplete) | -
Font/Font Style Information: | -Can set but can't get final format | -
Description/Help: | -Limited to HTML 4.0 - Alt Text, title text | -
Accessible value: | -Limited to form elements | -
Coordinates (Bounding rectangle, etc.): | -User Agents. platform accessibility API | -
Accessible Name: | -- |
Respond Desktop Font/Color - Changes: | -Partial (conflicts with CSS and JavaScript) | -
Device independent navigation: | -- |
Accessibility API Mapping: | -Partial - User Agents | -
Provide focus to all active elements (important for - equivalent keyboard access on desktops) | -Limited to forms and anchors | -
This section has not been updated since it was integrated from the ARIA 1.0 Primer -- an APG task force review is pending.
-At this time,W3C WAI Protocols and - Formats working group's primary focus is on extensions to HTML 4.01 and XHTML 1.X by extending the host language to include WAI-ARIA with a migration path to HTML 5. This will require the creation of new hybrid document type definitions (DTDs) that incorporate the extensions. This work will be in the [[WAI-ARIA]] specification. WAI-ARIA will constitute - extensions to fill most of the gaps needed to support - accessibility API infrastructures and dynamic (X)HTML content. The comprehensive gap analysis of (X)HTML, used to form WAI-ARIA is found in Table 1.0 and how WAI-ARIA fills those gaps. In the future we hope to incorporate WAI-ARIA into many host languages to improve their accessibility. The critical extensions needed to make accessible dynamic Web content accessible, through rich interoperability with assistive technologies, - are summarized here:
---States, and Property attributes - This is the set of attribute modifications to (X)HTML necessary to provide full keyboard focus and states and properties that may be mapped directly or indirectly to platform accessibility APIs to ensure full interoperability with assistive technologies for WAI-ARIA.
-Role attribute - The role attribute, borrowed from the, [[ROLE-ATTRIBUTE]], allows the author to annotate host languages with machine-extractable semantic information about the purpose of an element. It is targeted for accessibility, device adaptation, server-side processing, and complex data description. WAI-ARIA uses the role attribute to provides the role information, in to an assistive technology.
-Role document landmark values - These values, borrowed from the [[ROLE-ATTRIBUTE]] provides a standard set of role attribute values designed to define pertinent parts of a document (landmarks) for the purpose of accessibility. User agents may incorporate device equivalents, such as key mappings in the case of a desktop user agent, to navigate to these sections of a document.
-Taxonomy of WAI-ARIA role values - The necessary core roles found in Accessibility API sets - for Windows and Linux as well as roles representative of document structure, such as banner or treegrid. Use of document - structure is necessary for assistive technologies to navigate - complex documents and to know when they have entered active areas - of a Web page such as in the case of a dynamic scripted Web - application. The taxonomy is designed to help user agents or - authoring tools determine what properties a given role supports and to assist with accessibility API mapping of these - properties. The taxonomy will is like a class hierarchy used to - convey semantics and structure and includes knowledge about each - role. At this time, that taxonomy is modeled using [[RDF-CONCEPTS]] and [[OWL-FEATURES]].
-
In short, WAI-ARIA will be used to fix the dynamic accessibility of scripted Web content, - in particular the use of JavaScript with (X)HTML markup. They are meant to be - cross-cutting and should apply to other markup like SVG. Less - critical for (X)HTML but helpful for accessibility - will be the descriptive extensions to XML events and the new [[XHTML Access]]. Web Content Accessibility Guidelines 2.0 calls for the WAI-ARIA properties in guideline 4.1 Maximize compatibility with current and future agents, including assistive technologies (roles, states, properties, and values) and section guideline 1.3 Create content that can be presented in different ways (for example spoken aloud, simpler layout, etc.) without losing information or structure (relationships).
-The - next section describes how the specifications are used together as well as how they will be implemented in HTML 4.
-Adaptive technologies, which need to provide alternative access to
- complex user interfaces authored via HTML, are often left guessing
- at the semantics behind specific portions of HTML document. As an
- example, an XHTML document might use a certain HTML construct, such
- as a collection of DIV
tags, to create navigation bars, a
- site-navigation menu, and other GUI-like user interface widgets. To
- fix the problem, we incorporate the role
- attribute, assign the accessible state properties, and give the object
- focus using the new TABINDEX
feature. Addition of this information
- helps authors to provide the necessary information to
- enable the user agent to support the accessibility API accessed by
- the adaptive technology.
Each platform accessibility API has the notion of a "role" for a - GUI object. This is the case for [[JAPI]], [[MSAA]]], [[AXAPI]], and the [[ATK]], or [[UI-AUTOMATION]] (called content type in UI Automation). The WAI-ARIA specifications are based on XHTML 1.X and include the role attribute. The "role" attribute takes a qname, enabling authors to reference the role attribute from the WAI-ARIA Roles. In - the following example, we use qname to reference the menu role in the WAI-ARIA specification.
-Example: Use of WAI-ARIA to incorporate - role information into XHTML 1.x
--<?xml version="1.1" encoding="us-ascii"?> -<!DOCTYPE html PUBLIC "Accessible Adaptive Applications//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" -> - <body> - <div role="menu"> - File - </div> - </body> -</html> --
WAI used RDF/OWL to model our taxonomy for WAI-ARIA. In fact, if a host language sought to use namespaces or qnames, they could do so to reference the WAI-ARIA role taxonomy. The WAI-ARIA role taxonomy could be used by authoring tool developers to ensure that states and properties assigned to a given role are accurate.
-Since this is dynamic content, the state of these new repurposed - objects will change. The WAI-ARIA specification shall provide the common - accessible properties needed to support the accessible state or - property information provided by the platform accessibility API - defined previously. This specification was created based on an - analysis of the accessibility properties defined in MSAA and ATK. - The following example extends the previous approach by adding the aria-haspopup accessibility property.
-Example: Use of WAI-ARIA to incorporate accessible state information into XHTML 1.x
--<?xml version="1.1" encoding="us-ascii"?> -<!DOCTYPE html PUBLIC "Accessible Adaptive Applications//EN" - http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - -> - <body> - <div role="menu" aria-haspopup="true"> - File - </div> - </body> -</html> --
A Windows user agent may now map this property to the Microsoft
- Active Accessibility state of STATE_SYSTEM_HASPOPUP
. Adding or
- removing this state would result in the Windows user agent sending
- an EVENT_OBJECT_STATECHANGE
event to the assistive technology. The
- task of the JavaScript page author would be to maintain this state
- attribute, which can easily be done through the use of Document
- Object Model calls.
Virtually all adaptive technology solutions, such as screen - readers and onscreen keyboards, must know which object currently - has focus. For example, an author might want to insert text into the - current object with focus or to announce information - about the object that has focus. With today's HTML 4.01 and XHTML 1.x, script authors can only provide focus to form - and anchor elements yet the Document Object Model Specification - allows all elements to receive events including keyboard events. - This means that HTML, by design prohibits script authors from - making all HTML elements keyboard accessible. This single problem - effects usability of Web pages where one gains access to - elements by using the Tab key on desktop browsers. This slow, - unproductive, approach makes portal navigation difficult because all active elements must be tabbed through to put focus on an - active element in the last portlet in a document. To solve this - problem in XHTML 1.x, we are incorporating a feature in Firefox and - Internet Explorer to define the tabindex for -1. This allows a script author to - give an element focus without placing it in the tab order: The - following table describes these changes that will be incorporated - into the new Accessible Adaptive Application specification.
-tabindex attribute | -Focusable with mouse or JavaScript via element.focus() | -Tab navigable | -
---|---|---|
not present | -Follows default behavior of element (yes for form controls, - links, etc.) | -Follows default behavior of element | -
Negative, e.g. tabindex="-1" |
- Yes | -No, author must focus it with element.focus() as a
- result of arrow or other key press |
-
Zero, e.g. tabindex="0" |
- Yes | -In tab order relative to element's position in document | -
Positive, e.g. tabindex="33" |
- Yes | -Tabindex value directly specifies where this element is - positioned in the tab order. These elements will be positioned in - the tab order before elements that have tabindex="0" or that are - naturally included in the tab order (form elements and links) | -
The following example shows the introduction of TABINDEX
to
- provide focus to a DIV
having the new accessibility meta data:
Example: Use of tabindex to give non-form - and anchor elements focus in XHTML 1.x
--<?xml version="1.1" encoding="us-ascii"?> - <!DOCTYPE html PUBLIC "Accessible Adaptive Applications//EN" - http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - -> - <body> - <div role="menu" aria-haspopup="true" tabindex=-1> - File - </div> - </body> -</html> --
Unlike XHTML, HTML 4.01 is non-extensible in that it is not possible to extend HTML 4 through the use of namespaces. That said, members of the working group have worked with the HTML working group to agree on a vehicle that does not use namespaces, which at this time is supported by XHTML and HTML which will be supported in HTML 5 when it becomes recommendation. Firefox 3 is leading the way to implement this, and other browser manufacturers are working to support it as well. The technique allows all role values specified in WAI-ARIA (including those specified by the XHTML Role attribute module) to be specified without a namespace prefix. Additionally, WAI-ARIA states and properties shall be represented as aria- followed by the concatenated WAI-ARIA state or property.
-Example: Browser supported HTML technique for the tabindex example in section 5.1.3
-- -<html lang="en"> - <head>-
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head> - <body> - <div role="menu" aria-haspopup="true" tabindex=-1> - File - </div> - </body> -</html> -
In order to validate these extended attributes for HTML and XHTML the WAI-PF working group will investigate the creation of an enhanced schema or DTD for each host language.
-
The WAI-ARIA role taxonomy was modeled using semantic web technology, in the form of [[RDF-CONCEPTS]] and the [[OWL-FEATURES]], as a vehicle to define a knowledge-based class hierarchy for roles. This model shows what states and properties are supported, by each role in the taxonomy. The role in the class hierarchy inherits properties from its ancestors and defines its own properties. Where applicable, semantic web technology is used to define related concepts within other namespaces. This information is critical in determining how to choose a role and how to interact with it. The role taxonomy uses RDF as a way for using data to describe data and provides a - W3C standards-based approach to represent this information.
-shows a basic RDF mapping that - defines a set of terms and relationships defining an object. At the - center is a Widget object that defines common states and properties - for all GUI widgets. The Button object extends Widget and inherits - defined accessibility properties from the superclass Widget. It - also defines a relatedConcept property to a Link object. - The ButtonUndo role extends Button. It has a relatedConcept of an HTML input object. - ButtonUndo will introduce Dublin Core meta data such as the - description of the object. The terms relatedConcept and - requiredState are terms that will be defined as part of the - corresponding RDF schema. Each role instance will represent - standard Roles found in the platform accessibility APIs of platforms like - Windows and Gnome as well as content structure. These roles will - form the taxonomy. Although host language browser implementations may reference WAI-ARIA roles without namespaces, the RDF representation for a given role may be referenced using a - qname from a Host XML markup language. This examples shows an XHTML reference to a grid role in the RDF representation of the WAI-ARIA taxonomy:
-<div
- role="grid">
whereby grid
expands to:
- http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#grid in the
- button markup.
The power of this design is that it enables a web authoring tool to go back - into the corresponding RDF/OWL markup and determine what properties it - supports for Accessibility API mapping. Additional, middleware solutions can now make intelligent - transformations of Web Content by processing the semantics behind - rich browser and rich structured frameworks to adapt accessible - solutions for a broader user base. Our immediate goal is to fix the - accessibility problem with scripted Web content. Assistive - technologies will use the standard roles to determine how to render - most content.
-To understand the power of this approach, consider the case of a Grid Role, analogous to a table. shows a DHTML example using - XHTML, JavaScript, and CSS to produce a GUI-like application. This - example developed in IBM shows a notebook - tab with a data grid that behaves like a traditional desktop GUI. - The user uses arrow keys to navigates the data grid and among the page tabs. - Using the Tab key, a user navigates between the notebook tab, the edit fields, buttons, and - the data grid.
-Accessible role and state - meta data from the WAI-WAI-ARIA Roles, States, and Properties specification, are added as attributes to - each of the XHTML elements repurposed as GUI widgets dynamically. - The user agent, in this case Firefox, maps this information to the - platform accessibility API. shows - the Microsoft Active Accessibility rendering of the new - accessibility markup provided on the DataGrid page tab which has - focus.
-show a Microsoft Inspect 32 - rendering of the DataGrid Page page tab in Figure 5.0. Inspect32 - provides Microsoft Active Accessibility information; here it shows the - accessible role of "page tab" and accessible state information of - focused, focusable, and linked. There are no page tab elements in - XHTML. Here, an XHTML DIV element is repurposed by a - JavaScript controller to look like a notebook tab. It is now able - to receive focus, unlike in standard XHTML 1.X, and it does so without - requiring tabbing. With these specifications, the script - author can now add the accessibility properties to support platform - accessibility API. Accessible state properties for the DataGrid - page tab are shown as focused, focusable, and linked. Unlike a GUI - application, authors need only enable their applications once for - multiple operating system platforms.
-Beyond scripted Web content, the working group intends to extend - the use of roles to enable other user cases. These may include:
-<span
- role="role:nonliteral" aria:hasAlternate="no">
Interoperability between applications and assistive technologies - requires event notification for accessibility. The events will be fired via the user - agent. The accessible value and state property changes will be - generated in response to changes in the DOM attributes as defined - by the WCAG 1.0 AAA specification. User agents supporting the platform - accessibility API, will support event notification such as the state change or value change events.
-This section has not been updated since it was integrated from the ARIA 1.0 Primer -- an APG task force review is pending.
-This section provides a brief introduction to the process of making applications accessible using WAI-ARIA. The choice and usage of roles can be complex and context dependent. It is beyond the scope of this document to explain implementations for all the possible WAI-ARIA use cases. WAI-ARIA Authoring Practices provides detailed guidance on WAI-ARIA implementation methodology as well as references to sample code.
-First steps to making an application accessible:
-WAI-ARIA provides authors with the means to make the different elements in a web application semantically rich. User agents use the role semantics to understand how to handle each element. Roles convey additional information that the assistive technologies need to anticipate the behavior of the elements inside the application such as how to present the corresponding WAI-ARIA states and properties to the user. The user agent will use the accessibility semantics from the host language and WAI-ARIA accessibility semantics (which may augment or override those of the host language) and present them to assistive technologies through the Document Object Model or the platform accessibility API. The user agent will create an accessible representation of each element in the web page, and will use the appropriate accessibility API to notify assistive technologies of changes to the semantics of those elements.
-The following steps are recommended when WAI-ARIA is applied to content:
-Use native markup when possible.
-Use the semantic elements that are defined in the host markup language. For example, with HTML or XHTML, it is better to use the native checkbox than to use a div element with role checkbox
as these should already be accessible through your browser. There may also be cases where WAI-ARIA can augment an existing element in the host language. For example, a grid
and gridcell
elements can reuse the functionality of a table when overlaying it. WAI-ARIA roles, states, and properties are best used when the markup language does not support all the semantics required. When a role attribute is added to an element, the semantics and behavior of the element are augmented or overridden by the role behavior.
Apply the appropriate roles.
-Set roles to make sure elements behave predictably and correctly describe the behavior of each element within the application, unless element behaviors are fully described by the native markup language. Roles for interactive elements should support all the attributes that the element could use. Once a role attribute is set it should not be changed as this may confuse the end user. This does not preclude an element being removed which has the role attribute set, but only states and properties (aria-* attributes) should be changed for a given element.
-Preserve semantic structure.
-Structural information is critical to providing context to persons with disabilities. Preserve DOM hierarchy within structural elements and widgets:
-Build relationships.
-Look for relationships between elements, and mark them using the most appropriate property or attribute. For example, if a page contains both a search form and search results region, mark each container as a region
and set the aria-controls attribute of the search form to reference the search results. See relationships in WAI-ARIA.
Some relationships are determined automatically from the host language, like label
elements associated with input
elements in HTML.
Set states and properties in response to events.
-Once the role for an element has been set, change states and properties as appropriate during the element's life cycle, usually in response to user input events. Only use attributes supported for the chosen role or element.
-User agents should notify assistive technologies of state changes. Conversely, assistive technologies' notification of property changes depends on the method by which assistive technologies communicate with the user agent. For example, the aria-multiline attribute (a property) is not something that changes frequently, whereas the aria-checked attribute (a state) changes frequently in response to user input.
-Support full, usable keyboard navigation.
-Usable keyboard navigation in a rich internet application is different from the tabbing paradigm in a static document. Rich internet applications behave more like desktop applications where the user tabs to significant widgets and uses the arrow keys to navigate within a complex widget, such as a menu or spreadsheet. The changes that WAI-ARIA introduces in keyboard navigation make this enhanced accessibility possible. Tabbing in the document should follow a logical navigation structure. Authors implementing arrow key navigation should, where possible, follow the design patterns in the WAI-ARIA Authoring Practices Guide. When using these features, it is important as always to ensure keyboard navigation is logical.
-Synchronize the visual interface with the accessible interface.
-This will allow the state of your UI to be perceivable to the user as well as assistive technologies. For example, the author should use the appropriate WAI-ARIA attribute on a form element that is visually styled to appear required (aria-required
) or a gridcell that is visually styled to appear selected (aria-selected
). Authors may choose to achieve visual synchronization of these interface elements by using a script or by using CSS attribute selectors.
A basic tree view allows the user to select different list items and expand and collapse embedded lists. Arrow keys are used to navigate through a tree, including left/right to collapse/expand sub trees. Clicking the visible expander button with the mouse also toggles expansion. Further keyboard implementation details for tree widgets may found in the .
-To make this feature accessible we need to:
-Following the steps below:
-Look at the native markup language
-Although standard list behavior is supported by the native ul
and li
elements in HTML, there is no element that natively supports list expansion and selection. Since there is not, we will need to use roles.
Finding the right roles
-Since there is no native tree element in HTML, we need to add roles from the taxonomy that support the additional states and properties needed. The roles that support tree behavior are:
-tree
: A tree is the main container element for our tree. It is a form of a select
where sub-level groups of treeitems may be collapsed and expanded.treeitem
: A treeitem is an option item of a tree. This is an element within a tree; sub-level groups of treeitems may be expanded or collapsed.group
: A group encloses a set of sub-level treeitems.Look for groups and build relationships
-Tree relationships can be made simply via the DOM and logical structure of the page. A tree element will be the main container encompassing all other elements in the tree. Each selectable item in the tree will be a treeitem.
-When a treeitem contains an embedded list of treeitems they will be all be embedded in a group. A group should be contained inside the tree item that is the parent item.
-<h1 id="treelabel">WAI-ARIA Tree Example</h1> -<ul role="tree" aria-labelledby="treelabel" aria-activedescendant="example_id" tabindex="0"> - <li role="treeitem" aria-expanded="true">Animals - <ul role="group"> - <li role="treeitem">Birds</li> - <li role="treeitem" aria-expanded="false">Cats - <ul role="group"> - <li role="treeitem">Siamese</li> - <li role="treeitem">Tabby</li> - </ul> - </li> - <li role="treeitem" aria-expanded="true">Dogs - <ul role="group"> - <li role="treeitem" aria-expanded="true">Small Breeds - <ul role="group"> - <li role="treeitem">Chihuahua</li> - <li role="treeitem" id="example_id">Italian Greyhound</li> - <li role="treeitem">Japanese Chin</li> - </ul> - </li> - <li role="treeitem" aria-expanded="false">Medium Breeds - <ul role="group"> - <li role="treeitem">Beagle</li> - <li role="treeitem">Cocker Spaniel</li> - <li role="treeitem">Pit Bull</li> - </ul> - </li> - <li role="treeitem" aria-expanded="false">Large Breeds - <ul role="group"> - <li role="treeitem">Afghan</li> - <li role="treeitem">Great Dane</li> - <li role="treeitem">Mastiff</li> - </ul> - </li> - </ul> - </li> - </ul> - </li> - <li role="treeitem" aria-expanded="true">Minerals - <ul role="group"> - <li role="treeitem">Zinc</li> - <li role="treeitem" aria-expanded="false">Gold - <ul role="group"> - <li role="treeitem">Yellow Gold</li> - <li role="treeitem">White Gold</li> - </ul> - </li> - <li role="treeitem">Silver</li> - </ul> - </li> - <li role="treeitem" aria-expanded="true">Vegetables - <ul role="group"> - <li role="treeitem">Carrot</li> - <li role="treeitem">Tomato</li> - <li role="treeitem">Lettuce</li> - </ul> - </li> -</ul>-
The use of aria-expanded
should mirror that which is visibly expanded on screen, so authors may wish to use CSS attribute selectors to toggle visibility or style of an item based on the value of an WAI-ARIA state or property. The following example would hide the sub-level groups of a collapsed tree node.
[aria-expanded="false"] [role="group"] { display: none; }-
- - At the time of this writing, this CSS example, while technically correct, will not redraw styles properly in some browsers if the attribute's value is changed dynamically. It may be necessary to toggle a class name, or otherwise force the browser to redraw the styles properly.
-Sometimes a tree structure is not explicit via the DOM and logical structure of a page. In such cases the relationships must still be made explicit using the states and properties. In the following example, the aria-owns attribute indicates that the div
with id "external_treeitem" should be considered a child of the ul
element with the attribute, even though it is not a child in the DOM.
... -<li role="treeitem" aria-expanded="true" aria-owns="external_group">Vegetables</li> -... -<ul role="group" id="external_group"> - <li role="treeitem">Carrot</li> - <li role="treeitem">Tomato</li> - <li role="treeitem">Lettuce</li> -</ul> -...-
Sometimes trees (and other lists or grids) cannot be completed represented in the DOM due to performance limitations of the browser. For example, an application interface may only need to display 100 items out of a set of 100,000. Including all 100,000 items in the DOM could cause performance problems on both the client and server machines.
-If items in a managed widget are loaded, for example, via the XMLHttpRequest object, and not present in the DOM at all times, authors should use aria-level
, aria-posinset
and aria-setsize
, and ensure that aria-owns
is not required to convey membership with the widget.
... -<li role="treeitem" aria-level="1" aria-posinset="3" aria-expanded="true" aria-setsize="3"> - Vegetables - <ul role="group"> - <li role="treeitem" aria-level="2" aria-posinset="6" aria-setsize="8">Carrot</li> - <li role="treeitem" aria-level="2" aria-posinset="7" aria-setsize="8">Tomato</li> - <li role="treeitem" aria-level="2" aria-posinset="8" aria-setsize="8">Lettuce</li> - </ul> -<li> -...-
Use states and properties in response to events
-Control the behavior of the element in response to user input events such as from the keyboard and the mouse, which includes maintaining the current states and properties for that element. For example, a tree control will need to respond to click events on the expand/collapse triggers, and key events on the currently active descendant. Use device-independent events with supporting JavaScript to handle user interaction. For detailed examples of this please refer to the Design Patterns section.
-This section has not been updated since it was integrated from the ARIA 1.0 Primer -- an APG task force review is pending.
-By adopting WAI-ARIA, both developers of static web sites and of dynamic Internet applications can improve the usability, accessibility, and scalability of their products. Developers of static web content can continue to follow the 1999 WCAG 1.0 standards, while improving usability and accessibility through the use of WAI-ARIA landmark roles, aria-labelledby relationships, and properties like aria-invalid and aria-required that can apply to HTML form controls. In richer, dynamic content, developers create custom widgets like calendars and spreadsheets based on technologies such as Ajax and CSS; to achieve accessibility, they need to use WCAG 2.0. Previously, when delivering rich Internet applications to users, to comply with WCAG 1.0, developers resorted to providing alternative, static content. While such measures met the WCAG 1.0 requirements, people using assistive technologies were not provided the richer user experience. When tables are used for layout, rather than CSS absolute positioning, historically, they have been problematic for assistive technologies to interpret. When the WAI-ARIA role of presentation is used on such tables, the assistive technology ignores the table structure, providing a more accessible experience without requiring major recoding.
-Consider a rich Internet application where developers attempt to achieve keyboard accessibility using markup language. Without WAI-ARIA, results may be keyboard accessible but not highly usable; consider a user having to press Tab thirty times to put focus on a checkbox. To achieve keyboard accessibility in HTML without WAI-ARIA, developers must code active elements either as a link or as a form element. Accordingly, this means that no additional semantics are required or provided, other than that provided by the host language. In addition, WCAG 1.0 requires that content be renderable with Cascading Style Sheets turned off in the browser. This approach creates the following general usability problems:
-WAI-ARIA and WCAG 2.0 coding techniques are useful for developing content and applications that can scale across a variety of user agents, including those on mobile devices.
-For all these reasons, adopting WAI-ARIA makes good technical as well as business sense. For a further illustration, compare how accessibility is achieved with WCAG techniques without and with WAI-ARIA, as shown in .
-Editor's Note: Figure 7, described as WAI-ARIA tree widget usability comparison, refers to a resource that has not yet been found.
-
-
- shows an "accessible" widget for a tree item, within a tree widget, using WCAG 1.0 without WAI-ARIA, which ,when supplied to a screen reader, may say "link folder Year." There is no information to indicate that the folder is closed (aria-expanded = "false"
). There is no information to indicate its depth (aria-level="2"
), position in the set and the set size at the level, all of which provides the user with context something sighted users may take for granted. The role is used to indicate that it is a treeitem which indicates that the item should behave and navigate with the keyboard like a tree item. A screen reader using the WAI-ARIA version might say "Closed Folder Year, Closed Folder one of two, Depth two, unchecked." Furthermore, the WAI-ARIA version can allow the tree items to be navigated with arrow keys and without requiring they be navigated as part of a global web page tabbing scheme. This is not what any user would expect of a tree widget. Finally, if you were told all widgets were links on the web page, consider how usable -- or not -- that would be.
If, as described above, coding techniques to achieve accessibility compliance do not promote overall usability, then business strategists must ask "Why invest in accessibility?" With WAI-ARIA, businesses can invest in accessible development and reap benefits for all users, not just those with disabilities or using assistive technologies. Some benefits include:
-- This document provides readers with an understanding of how to use WAI-ARIA 1.2 [[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.
-- This is an editor's draft by the - Accessible Rich Internet Applications Working Group - of the - Web Accessibility Initiative. - It supports the - [[[wai-aria-1.2]]] [[WAI-ARIA-1.2]] - specification, providing detailed advice and examples beyond what would be appropriate to a technical specification but which are important to understand the specification. -
-This draft includes only a portion of content planned for WAI-ARIA Authoring Practices 1.2. To see plans for the complete guide, review the Authoring Practices Milestone Plan.
-- Feedback on the information provided here is essential to the ultimate success of Rich Internet Applications that afford full access to their information and operations. - The Accessible Rich Internet Applications Working Group asks in particular: -
-- To comment, - file an issue in the W3C ARIA Practices GitHub repository, - or if that is not possible, send email to - public-aria-practices@w3.org - (comment archive). -
-- The ARIA Authoring Practices Guide (APG) explains how to create accessible web experiences for users of assistive technologies and keyboard interfaces by developing web sites that properly convey accessibility semantics and implement common keyboard conventions. - It also provides guidance on some closely related topics, such as supporting operating system settings for high contrast and reduced motion. -
-- Accessibility semantics refer to the meaning of user interface elements that need to be conveyed to assistive technology users in order for those users to understand and use the elements. - For example, people who can visually perceive a search icon button understand the element can be activated to perform a search by the way it is styled and positioned. - To make that icon accessible to a screen reader user, one of the semantics that needs to be communicated is that the element represents an interactive button. - In addition, keyboard accessibility requires the button to be focusable, and keyboard conventions call for pressing Enter or Space to activate the button when it is focused. - The APG describes how to convey accessibility semantics and implement keyboard accessibility for many common design patterns, ranging from typical buttons and popup menus to complex tree grids. - It also explains essential practices related to these patterns, such as how to convey web page structure with ARIA landmark regions and effectively utilize the many ways of encoding accessible names. -
-- The APG is organized into two major sections: patterns and practices. - Each pattern explains how to make a common user interface element, such as a button, menu, or dialog, accessible, and provides functional example implementations of the pattern. - The practices section gives in-depth explanation of how to satisfy a variety of accessibility needs that surface when making rich internet application experiences accessible. - For instance, the practices section on providing accessible names and descriptions gives detailed descriptions of seven different naming techniques as well as a table providing guidance for naming more than 80 types of elements. -
-- The APG assumes basic understanding of web development, especially of HTML and CSS. - It may be particularly useful to designers and engineers who are working on site design systems and component libraries. - However, it is important to understand that the APG only covers a portion of what is needed to create accessible experiences. - To understand accessibility more broadly, it is advisable to start with the WAI Accessibility Fundamentals and WAI Overview of Design and Development. -
-
- The accessibility semantics used in the APG patterns and described in APG practices are defined in the
- WAI-ARIA 1.2 Specification.
- That is, the ARIA specification standardizes the meaning of the attributes that describe elements and their states to assistive technologies, such as the meaning of role="button"
.
- These attributes and other features required to make sites usable by people who rely on assistive technologies or keyboard navigation are not natively included in the languages used to create web sites, such as HTML, JavaScript, CSS, and SVG.
- The W3C Web Accessibility Initiative's (WAI) Accessible Rich Internet Applications working group (ARIA WG) is addressing these deficiencies through several W3C standards efforts.
- The WAI-ARIA Overview
- provides additional background on WAI-ARIA, summarizes those efforts, and lists the other documents included in the WAI-ARIA suite.
-
- Functionally, ARIA roles, states, and properties are analogous to a CSS for assistive technologies. - For screen reader users, ARIA controls the rendering of their non-visual experience. - Incorrect ARIA misrepresents visual experiences, with potentially devastating effects on their corresponding non-visual experiences. -
-Before using ARIA or any of the guidance in this document, please take time to understand the following two essential principles.
-This code:
-
- <div role="button">Place Order</div>
-
-
- Is a promise that the author of that <div>
has also incorporated JavaScript that provides the keyboard interactions expected for a button.
- Unlike HTML input elements, ARIA roles do not cause browsers to provide keyboard behaviors or styling.
-
Using a role without fulfilling the promise of that role is similar to making a "Place Order" button that abandons an order and empties the shopping cart.
-One of the objectives of this guide is to define expected behaviors for each ARIA role.
-- The information assistive technologies need about the meaning and purpose of user interface elements is called accessibility semantics. - From the perspective of assistive technologies, ARIA gives authors the ability to dress up HTML and SVG elements with critical accessibility semantics that the assistive technologies would not otherwise be able to reliably derive. -
-Some of ARIA is like a cloak; it covers up, or overrides, the original semantics or content.
-
- <a role="menuitem">Assistive tech users perceive this element as an item in a menu, not a link.</a>
- <a aria-label="Assistive tech users can only perceive the contents of this aria-label, not the link text">Link Text</a>
-
- On the other hand, some uses of ARIA are more like suspenders or belts; they add meaning that provides essential support to the original content.
-
- <button aria-pressed="false">Mute</button>
-
- - This is the power of ARIA. - It enables authors to describe nearly any user interface component in ways that assistive technologies can reliably interpret, thus making components accessible to assistive technology users. -
-- This is also the danger of ARIA. - Authors can inadvertently override accessibility semantics. -
-
-
- <table role="log">
- <!--
- Table that assistive technology users will not perceive as a table.
- The log role tells browser this is a log, not a table.
- -->
- </table>
- <ul role="navigation">
- <!-- This is a navigation region, not a list. -->
- <li><a href="uri1">nav link 1</li>
- <li><a href="uri2">nav link 2</li>
- <!-- ERROR! Previous list items are not in a list! -->
- </ul>
-
-
- - Testing assistive technology interoperability is essential before using code from this guide in production. - Because the purpose of this guide is to illustrate appropriate use of ARIA 1.2 as defined in the ARIA specification, the design patterns, reference examples, and sample code intentionally do not describe and implement coding techniques for working around problems caused by gaps in support for ARIA 1.2 in browsers and assistive technologies. - It is thus advisable to test implementations thoroughly with each browser and assistive technology combination that is relevant within a target audience. -
-- Similarly, JavaScript and CSS in this guide is written to be compatible with the most recent version of Chrome, Firefox, and Safari at the time of writing. -Some JavaScript and CSS may not function correctly in Internet Explorer. -
-- Except in cases where the ARIA Working Group and other contributors have overlooked an error, - examples in this guide that do not function well in a particular browser or with a specific assistive technology are demonstrating browser or assistive technology bugs. - Browser and assistive technology developers can thus utilize code in this guide to help assess the quality of their support for ARIA 1.2. -
-- Currently, this guide does not indicate which examples are compatible with mobile browsers or touch interfaces. - While some of the examples include specific features that enhance mobile and touch support, some ARIA features are not supported in any mobile browser. - In addition, there is not yet a standardized approach for providing touch interactions that work across mobile browsers. -
-More guidance about touch and mobile support is planned for future releases of the guide.
-This section demonstrates how to make common rich internet application patterns and widgets accessible by applying WAI-ARIA roles, states, and properties and implementing keyboard support.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Providing elements with accessible names, and where appropriate, accessible descriptions is one of the most important responsibilities authors have when developing accessible web experiences. - While doing so is straightforward for most elements, technical mistakes that can completely block users of assistive technologies are easy to make and unfortunately common. - To help authors effectively provide accessible names and descriptions, this section explains their purpose, when authors need to provide them, how browsers assemble them, and rules for coding and composing them. - It also guides authors in the use of the following naming and describing techniques and WAI-ARIA properties: -
-aria-label
.aria-labelledby
.aria-describedby
.- An accessible name is a short string, typically 1 to 3 words, that authors associate with an element to provide users of assistive technologies with a label for the element. - For example, an input field might have an accessible name of "User ID" or a button might be named "Submit". -
-An accessible name serves two primary purposes for users of assistive technologies, such as screen readers:
-- Both the WAI-ARIA specification and WCAG require all focusable, interactive elements to have an accessible name. - In addition dialogs and some structural containers, such as tables and regions, are required to have a name. - Many other elements can be named, but whether a name will enhance the accessible experience is determined by various characteristics of the surrounding context. - Finally, there are some elements where providing an accessible name is technically possible but not advisable. - The Accessible Name Guidance by Role section lists naming requirements and guidelines for every ARIA role. -
-- An accessible description is also an author-provided string that is rendered by assistive technologies. - Authors supply a description when there is a need to associate additional information with an element, such as instructions or format requirements for an input field. -
-
- Assistive technologies present names differently from descriptions.
- For instance, screen readers typically announce the name and role of an element first, e.g., a button named Mute Conversation
could be spoken as Mute Conversation button
.
- If an element has a state, it could be announced either before or after the name and role; after name and role is the typical default.
- For example, a switch button named Mute Conversation
in the off
state could be announced as Mute Conversation switch button off
.
- Because descriptions are optional strings that are usually significantly longer than names, they are presented last, sometimes after a slight delay.
- For example, Mute Conversation Switch button off, Silences alerts and notifications about activity in this conversation.
- To reduce verbosity, some screen readers do not announce descriptions by default but instead inform users of their presence so that users can press a key that will announce the description.
-
- Because there are several elements and attributes for specifying text to include in an accessible name or description string, and because authors can combine them in a practically endless number of ways, browsers implement fairly complex algorithms for assembling the strings. -The sections on accessible name calculation and accessible description calculation explain the algorithms and how they implement precedence. -However, most authors do not need such detailed understanding of the algorithms since nearly all circumstances where a name or description is useful are supported by the coding patterns described in the naming techniques and describing techniques sections. -
-- Several of the naming techniques below include notes that warn against specific coding patterns that are either prohibited by the ARIA specification or fall into gray space that is not yet fully specified. - Some of these prohibited or ambiguous patterns may appear logical and even yield desired names in some browsers. - However, it is unlikely they will provide consistent results across browsers, especially over time as work to improve the consistency of name calculation across browsers progresses. -
-- In addition to heeding the warnings provided in the naming techniques, it is difficult to over emphasize the importance of testing to ensure that names browsers calculate match expectations. -
-- When a user interface includes visible text that could be used to provide an appropriate accessible name, using the visible text for the accessible name simplifies maintenance, prevents bugs, and reduces language translation requirements. - When names are generated from text that exists only in markup and is never displayed visually, there is a greater likelihood that accessible names will not be updated when the user interface design or content are changed. -
-- If an interactive element, such as an input field or button, does not have a visually persistent text label, consider adjusting the design to include one. - In addition to serving as a more robust source for an accessible name, visible text labels enhance accessibility for many people with disabilities who do not use assistive technologies that present invisible accessible names. - In most circumstances, visible text labels also make the user interface easier to understand for all users. -
-
- In HTML documents, whenever possible, rely on HTML naming techniques, such as the HTML label
element for form elements and caption
element for tables.
- While less flexible, their simplicity and reliance on visible text help ensure robust accessible experiences.
- Several of the naming techniques highlight specific accessibility advantages of using HTML features instead of ARIA attributes.
-
- When authors do not specify an accessible name using an element or attribute that is intended for naming, browsers attempt to help assistive technology users by resorting to fallback methods for generating a name.
- For example, the HTML title
and placeholder
attributes are used as last resort sources of content for accessible names.
- Because the purpose of these attributes is not naming, their content typically yields low quality accessible names that are not effective.
-
- Similar to how visually crowded screens and ambiguous icons reduce usability, excessively long, insufficiently distinct, or unclear accessible names can make a user interface very difficult, or even impossible, to use for someone who relies on a non-visual form of the user interface. - In other words, for a web experience to be accessible, its accessible names must be effective. - The section on Composing Effective and User-friendly Accessible Names provides guidance for balancing brevity and clarity. -
-- Certain elements get their name from the content they contain. - For example, the following link is named "Home". -
- -<a href="/">Home</a>
-
- - When assistive technologies render an element that gets its accessible name from its content, such as a link or button, the accessible name is the only content the user can perceive for that element. - This is in contrast to other elements, such as text fields or tables, where the accessible name is a label that is presented in addition to the value or content of the element. - For instance, the accessible name of a table can be derived from a caption element, and assistive technologies render both the caption and all other content contained inside the table. -
-Elements having one of the following roles are, by default, named by a string calculated from their descendant content:
-menu
element is excluded.)group
element is excluded.)
- When calculating a name from content for an element, user agents recursively walk through each of its descendant elements, calculate a name string for each descendant, and concatenate the resulting strings.
- In two special cases, certain descendants are ignored: group
descendants of treeitem
elements and menu
descendants of menuitem
elements are omitted from the calculation.
- For example, in the following tree
, the name of the first tree item is Fruits
; Apples
, Bananas
, and Oranges
are omitted.
-
<ul role="tree">
- <li role="treeitem">Fruits
- <ul role="group">
- <li role="treeitem">Apples</li>
- <li role="treeitem">Bananas</li>
- <li role="treeitem">Oranges</li>
- </ul>
- </li>
-</ul>
-
- If an element with one of the above roles that supports naming from child content is named by using aria-label
or aria-labelledby
, content contained in the element and its descendants is hidden from assistive technology users unless the descendant content is referenced by aria-labelledby
.
- It is strongly recommended to avoid using either of these attributes to override content of one of the above elements except in rare circumstances where hiding content from assistive technology users is beneficial.
- In addition, in situations where visible content is hidden from assistive technology users by use of one of these attributes, thorough testing with assistive technologies is particularly important.
-
aria-label
- The aria-label property enables authors to name an element with a string that is not visually rendered. - For example, the name of the following button is "Close". -
-<button type="button" aria-label="Close">X</button>
-
- The aria-label
property is useful when there is no visible text content that will serve as an appropriate accessible name.
-
- The aria-label
property affects assistive technology users in one of two different ways, depending on the role of the element to which it is applied.
- When applied to an element with one of the roles that supports naming from child content, aria-label
hides descendant content from assistive technology users and replaces it with the value of aria-label
.
- However, when applied to nearly any other type of element, assistive technologies will render both the value of aria-label
and the content of the element.
- For example, the name of the following navigation region is "Product".
-
<nav aria-label="Product">
- <!-- list of navigation links to product pages -->
-</nav>
- - When encountering this navigation region, a screen reader user will hear the name and role of the element, e.g., "Product navigation region", and then be able to read through the links contained in the region. -
-aria-label
is applied to an element with one of the roles that supports naming from child content, content contained in the element and its descendants is hidden from assistive technology users.
- It is strongly recommended to avoid using aria-label
to override content of one of these elements except in rare circumstances where hiding content from assistive technology users is beneficial.
- aria-label
. They are identified in the table in the Accessible Name Guidance by Role section.aria-label
is not rendered visually, testing with assistive technologies to ensure the expected name is presented to users is particularly important.aria-label
values are translated.aria-labelledby
- The aria-labelledby property enables authors to reference other elements on the page to define an accessible name. - For example, the following switch is named by the text content of a previous sibling element. -
-<span id="night-mode-label">Night mode</span>
-<span role="switch" aria-checked="false" tabindex="0" aria-labelledby="night-mode-label"></span>
-
- Note that while using aria-labelledby
is similar in this situation to using an HTML label
element with the for
attribute, one significant difference is that browsers do not automatically make clicking on the labeling element activate the labeled element; that is an author responsibility.
- However, HTML label
cannot be used to label a span
element.
- Fortunately, an HTML input
with type="checkbox"
allows the ARIA switch
role, so when feasible, using the following approach creates a more robust solution.
-
<label for="night-mode">Night mode</label>
-<input type="checkbox" role="switch" id="night-mode">
- The aria-labelledby
property is useful in a wide variety of situations because:
It has the highest precedence when browsers calculate accessible names, i.e., it overrides names from child content and all other naming attributes, including aria-label
.
It can concatenate content from multiple elements into a single name string.
It incorporates content from elements regardless of their visibility, i.e., it even includes content from elements with the HTML hidden
attribute, CSS display: none
, or CSS visibility: hidden
in the calculated name string.
It incorporates the value of input elements, i.e., if it references a textbox, the value of the textbox is included in the calculated name string.
An example of referencing a hidden element with aria-labelledby
could be a label for a night switch control:
<span id="night-mode-label" hidden>Night mode</span>
-<input type="checkbox" role="switch" aria-labelledby="night-mode-label">
-
-
- In some cases, the most effective name for an element is its own content combined with the content of another element.
- Because aria-labelledby
has highest precedence in name calculation, in those situations, it is possible to use aria-labelledby
to reference both the element itself and the other element.
- In the following example, the "Read more..." link is named by the element itself and the article’s heading, resulting in a name for the link of "Read more... 7 ways you can help save the bees".
-
<h2 id="bees-heading">7 ways you can help save the bees</h2>
-<p>Bees are disappearing rapidly. Here are seven things you can do to help.</p>
-<p><a id="bees-read-more" aria-labelledby="bees-read-more bees-heading">Read more...</a></p>
-
- When multiple elements are referenced by aria-labelledby
, text content from each referenced element is concatenated in the order specified in the aria-labelledby
value.
- If an element is referenced more than one time, only the first reference is processed.
- When concatenating content from multiple elements, browsers trim leading and trailing white space and separate content from each element with a single space.
-
<button id="download-button" aria-labelledby="download-button download-details">Download</button>
-<span id="download-details">PDF, 2.4 MB</span>
- In the above example, the accessible name of the button will be "Download PDF, 2.4 MB", with a space between "Download" and "PDF", and not "DownloadPDF, 2.4 MB".
-aria-labelledby
property cannot be chained, i.e., if an element with aria-labelledby
references another element that also has aria-labelledby
, the aria-labelledby
attribute on the referenced element will be ignored.aria-labelledby
more than one time during a name calculation, the second and any subsequent references will be ignored.aria-labelledby
. They are identified in the table in the Accessible Name Guidance by Role section.aria-labelledby
is applied to an element with one of the roles that supports naming from child content, content contained in the element and its descendants is hidden from assistive technology users unless it is also referenced by aria-labelledby
.
- It is strongly recommended to avoid using this attribute to override content of one of these elements except in rare circumstances where hiding content from assistive technology users is beneficial.
- aria-labelledby
can be complex and reference hidden content, testing with assistive technologies to ensure the expected name is presented to users is particularly important.
- The HTML label
element enables authors to identify content that serves as a label and associate it with a form control.
- When a label
element is associated with a form control, browsers calculate an accessible name for the form control from the label
content.
-
- For example, text displayed adjacent to a checkbox may be visually associated with the checkbox, so it is understood as the checkbox label by users who can perceive that visual association.
- However, unless the text is programmatically associated with the checkbox, assistive technology users will experience a checkbox without a label.
- Wrapping the checkbox and the labeling text in a label
element as follows gives the checkbox an accessible name.
-
<label>
- <input type="checkbox" name="subscribe">
- subscribe to our newsletter
-</label>
-
- A form control can also be associated with a label by using the for
attribute on the label
element.
- This allows the label and the form control to be siblings or have different parents in the DOM, but requires adding an id
attribute to the form control, which can be error-prone.
- When possible, use the above encapsulation technique for association instead of the following for
attribute technique.
-
<input type="checkbox" name="subscribe" id="subscribe_checkbox">
-<label for="subscribe_checkbox">subscribe to our newsletter</label>
-
- Using the label
element is an effective technique for satisfying Rule 2: Prefer Visible Text.
- It also satisfies Rule 3: Prefer Native Techniques.
- Native HTML labels offer an important usability and accessibility advantage over ARIA labeling techniques: browsers automatically make clicking the label equivalent to clicking the form control.
- This increases the hit area of the form control.
-
- The HTML fieldset
element can be used to group form controls, and the legend
element can be used to give the group a name.
- For example, a group of radio buttons can be grouped together in a fieldset
, where the legend
element labels the group for the radio buttons.
-
<fieldset>
- <legend>Select your starter class</legend>
- <label><input type="radio" name="starter-class" value="green">Green</label>
- <label><input type="radio" name="starter-class" value="red">Red</label>
- <label><input type="radio" name="starter-class" value="blue">Blue</label>
-</fieldset>
- - This grouping technique is particularly useful for presenting multiple choice questions. - It enables authors to associate a question with a group of answers. - If a question is not programmatically associated with its answer options, assistive technology users may access the answers without being aware of the question. -
-
- Similar benefits can be gained from grouping and naming other types of related form fields using fieldset
and legend
.
-
<fieldset>
- <legend>Shipping address</legend>
- <p><label>Full name <input name="name" required></label></p>
- <p><label>Address line 1 <input name="address-1" required></label></p>
- <p><label>Address line 2 <input name="address-2"></label></p>
- ...
-</fieldset>
-<fieldset>
- <legend>Billing address</legend>
- ...
-</fieldset>
- Using the legend
element to name a fieldset
element satisfies Rule 2: Prefer Visible Text and Rule 3: Prefer Native Techniques.
- The accessible name for HTML table
and figure
elements can be derived from a child caption
or figcaption
element, respectively.
- Tables and figures often have a caption to explain what they are about, how to read them, and sometimes giving them numbers used to refer to them in surrounding prose.
- Captions can help all users better understand content, but are especially helpful to users of assistive technologies.
-
- In HTML, the table
element marks up a data table, and can be provided with a caption using the caption
element.
- If the table
element does not have aria-label
or aria-labelledby
, then the caption
will be used as the accessible name.
- For example, the accessible name of the following table is Special opening hours
.
-
<table>
- <caption>Special opening hours</caption>
- <tr><td>30 May</td><td>Closed</td></tr>
- <tr><td>6 June</td><td>11:00-16:00</td></tr>
-</table>
- The following example gives the table a number (Table 1
) so it can be referenced.
<table>
- <caption>Table 1. Traditional dietary intake of Okinawans and other Japanese circa 1950</caption>
- <thead>
- <tr>
- <th></th>
- <th>Okinawa, 1949</th>
- <th>Japan, 1950</th>
- </tr>
- <tbody>
- <tr>
- <th>Total calories</th>
- <td>1785</td>
- <td>2068</td>
-
- [...]
-
-</table>
- Note: Above table content is from Caloric restriction, the traditional Okinawan diet, and healthy aging: the diet of the world's longest-lived people and its potential impact on morbidity and life span.
-
- If a table
is named using aria-label
or aria-labelledby
, then a caption
element, if present, will become an accessible description.
- For an example, see Describing Tables and Figures with Captions.
-
- Similarly, an HTML figure
element can be given a caption using the figcaption
element.
- The caption can appear before or after the figure, but it is more common for figures to have the caption after.
-
<figure>
- <img alt="Painting of a person walking in a desert." src="Hole_JesusalDesierto.jpg">
- <figcaption>Jesus entering the desert as imagined by William Hole, 1908</figcaption>
-</figure>
-
- Like with table
elements, if a figure
is not named using aria-label
or aria-labelledby
, the content of the figcaption
element will be used as the accessible name.
- However unlike table
elements, if the figcaption
element is not used for the name, it does not become an accessible description unless it is referenced by aria-describedby
.
- Nevertheless, assistive technologies will render the content of a figcaption
regardless of whether it is used as a name, description, or neither.
-
Using the caption
element to name a table
element, or a figcaption
element to name a figure
element, satisfies Rule 2: Prefer Visible Text and Rule 3: Prefer Native Techniques.
- When an accessible name is not provided using one of the primary techniques (e.g., the aria-label
or aria-labelledby
attributes), or native markup techniques (e.g., the HTML label
element, or the alt
attribute of the HTML img
element), browsers calculate an accessible name from other attributes as a fallback mechanism.
- Because the attributes used in fallback name calculation are not intended for naming, they typically yield low quality accessible names that are not effective.
-So, As advised by Rule 4: Avoid Browser Fallback, prefer the explicit labeling techniques described above over fallback techniques described in this section.
-
- Any HTML element can have a title
attribute specified.
- The title
attribute may be used as the element's fallback accessible name.
- The title
attribute is commonly presented visually as a tooltip when the user hovers over the element with a pointing device, which is not particularly discoverable, and is also not accessible to visual users without a pointing device.
-
For example, a fieldset
element without a legend
element child, but with a title
attribute, gets its accessible name from the title
attribute.
<fieldset title="Select your starter class">
- <label><input type="radio" name="starter-class" value="green">Green</label>
- <label><input type="radio" name="starter-class" value="red">Red</label>
- <label><input type="radio" name="starter-class" value="blue">Blue</label>
-</fieldset>
-
-
- For the HTML input
and textarea
elements, the placeholder
attribute is used as a fallback labeling mechanism if nothing else (including the title
attribute) results in a label.
- It is better to use a label
element, since it does not disappear visually when the user focuses the form control.
-
<!-- Using a <label> is recommended -->
-<label>Search <input type=search name=q></label>
-
-<!-- A placeholder is used as fallback -->
-<input type=search name=q placeholder="Search">
- - For assistive technology users, especially screen reader users, the quality of accessible names is one of the most significant contributors to usability. - Names that do not provide enough information reduce users' effectiveness while names that are too long reduce efficiency. - And, names that are difficult to understand reduce effectiveness, efficiency, and enjoyment. -
-The following guidelines provide a starting point for crafting user friendly names.
-Xcloses a dialog, name it
Close, not
X. - Similarly, if a set of navigation links in the left side bar navigate among the product pages in a shopping site, name the navigation region
Product, not
Left. -
Edit,
Delete, and
Actionsbuttons for each contact, - then
Edit John Doe,
Delete John Doe, and
Actions for John Doewould be better accessible names than
John Doe edit,
John Doe delete, and
John Doe actions. - By placing the verb first in the name, screen reader users can more easily and quickly distinguish the buttons from one another as well as from the element that opens the contact card for John Doe. -
buttonin the name of a button, the word
imagein the name of an image, or the word
navigationin the name of a navigation region. - Doing so would create duplicate screen reader output since screen readers convey the role of an element in addition to its name. -
- Certain elements always require a name, others may usually or sometimes require a name, and still others should never be named. - The table below lists all ARIA roles and provides the following information for each : -
-aria-label
or aria-labelledby
is applied, content contained in the element and its descendants is hidden from assistive technology users unless it is also referenced by aria-labelledby
.
- Avoid hiding descendant content except in the rare circumstances where doing so benefits assistive technology users.
- role | -Necessity of Naming | -Guidance | -
---|---|---|
alert |
- Discretionary | -
- Some screen readers announce the name of an alert before announcing the content of the alert.
- Thus, aria-label provides a method for prefacing the visible content of an alert with text that is not displayed as part of the alert.
- Using aria-label is functionally equivalent to providing off-screen text in the contents of the alert, except off-screen text would be announced by screen readers that do not support aria-label on alert elements.
- |
-
alertdialog |
- Required | -Use aria-labelledby if a visible label is present, otherwise use aria-label . |
-
application |
- Required | -Use aria-labelledby if a visible label is present, otherwise use aria-label . |
-
article |
- Recommended | -
-
|
-
banner |
- Discretionary | -
-
|
-
blockquote |
- Discretionary | -
- If a visible label is present, associating it with the blockquote by using aria-labelledby could benefit some assistive technology users.
- |
-
button |
- Required Only If Content Insufficient | -
-
|
-
caption |
- Prohibited | -- |
cell |
- Required Only If Content Insufficient | -
-
|
-
checkbox |
- Required Only If Content Insufficient | -
-
|
-
code |
- Prohibited | -- |
columnheader |
- Required Only If Content Insufficient | -
-
|
-
combobox |
- Required | -
-
|
-
complementary |
- Recommended | -
-
|
-
contentinfo |
- Discretionary | -
-
|
-
definition |
- Recommended | -Reference the term being defined with role="term" , using aria-labelledby . |
-
deletion |
- Prohibited | -- |
dialog |
- Required | -Use aria-labelledby if a visible label is present, otherwise use aria-label . |
-
directory |
- Discretionary | -
-
|
-
document |
- Discretionary | -
- Elements with the document role are contained within an element with the application role, which is required to have a name.
- Typically, the name of the application element will provide sufficient context and identity for the document element.
- Because the application element is used only to create unusual, custom widgets, careful assessment is necessary to determine whether or not adding an accessible name is beneficial.
- |
-
emphasis |
- Prohibited | -- |
feed |
- Recommended | -
-
|
-
figure |
- Recommended | -
-
|
-
form |
- Recommended | -
-
|
-
generic |
- Prohibited | -- |
grid |
- Required | -
-
|
-
gridcell |
- Required Only If Content Insufficient | -
-
|
-
group |
- Discretionary | -
-
|
-
heading |
- Required Only If Content Insufficient | -
-
|
-
insertion |
- Prohibited | -- |
img |
- Required | -For the HTML img element, use the alt attribute. For other elements with the img role, use aria-labelledby or aria-label . |
-
link |
- Required Only If Content Insufficient | -
-
|
-
list |
- Discretionary | -
-
|
-
listbox |
- Required | -
-
|
-
listitem |
- Do Not Name | -Naming is not supported by assistive technologies; it is necessary to include relevant content within the list item. | -
log |
- Discretionary | -
- Some screen readers announce the name of a log element before announcing the content of the log element.
- Thus, aria-label provides a method for prefacing the visible content of a log element with text that is not displayed as part of the log element.
- Using aria-label is functionally equivalent to providing off-screen text in the contents of the log element, except off-screen text would be announced by screen readers that do not support aria-label on log elements.
- |
-
main |
- Discretionary | -
-
|
-
marquee |
- Discretionary | -Use aria-labelledby if a visible label is present, otherwise use aria-label . |
-
math |
- Recommended | -
-
|
-
menu |
- Recommended | -
-
|
-
menubar |
- Recommended | -
-
|
-
menuitem |
- Required Only If Content Insufficient | -
-
|
-
menuitemcheckbox |
- Required Only If Content Insufficient | -
-
|
-
menuitemradio |
- Required Only If Content Insufficient | -
-
|
-
meter |
- Required | -
-
|
-
navigation |
- Recommended | -
-
|
-
none |
- Prohibited | -An element with role="none" is not part of the accessibility tree (except in error cases). Do not use aria-labelledby or aria-label . |
-
note |
- Discretionary | -
-
|
-
option |
- Required Only If Content Insufficient | -
-
|
-
paragraph |
- Prohibited | -- |
presentation |
- Prohibited | -An element with role="presentation" is not part of the accessibility tree (except in error cases). Do not use aria-labelledby or aria-label . |
-
progressbar |
- Required | -
-
|
-
radio |
- Required Only If Content Insufficient | -
-
|
-
radiogroup |
- Required | -
-
|
-
region |
- Required | -
-
|
-
row |
-
- Required Only If Content Insufficient
- AND descendant of a treegrid
- AND the row is focusable
- |
-
- When row elements are focusable in a treegrid, screen readers announce the entire contents of a row when navigating by row.
- This is typically the most appropriate behavior.
- However, in some circumstances, it could be beneficial to change the order in which cells are announced or exclude announcement of certain cells by using aria-labelledby to specify which cells to announce.
- |
-
rowgroup |
- Do Not Name | -Naming is not supported by assistive technologies. | -
rowheader |
- Required Only If Content Insufficient | -
-
|
-
scrollbar |
- Discretionary | -
-
|
-
search |
- Recommended | -
-
|
-
searchbox |
- Required | -
-
|
-
separator |
- Discretionary | -
-
|
-
slider |
- Required | -
-
|
-
spinbutton |
- Required | -
-
|
-
status |
- Discretionary | -
- Some screen readers announce the name of a status element before announcing the content of the status element.
- Thus, aria-label provides a method for prefacing the visible content of a status element with text that is not displayed as part of the status element.
- Using aria-label is functionally equivalent to providing off-screen text in the contents of the status element, except off-screen text would be announced by screen readers that do not support aria-label on status elements.
- |
-
strong |
- Prohibited | -- |
subscript |
- Prohibited | -- |
superscript |
- Prohibited | -- |
switch |
- Required Only If Content Insufficient | -
-
|
-
tab |
- Required Only If Content Insufficient | -
-
|
-
table |
- Required | -
-
|
-
tablist |
- Recommended | -
-
|
-
tabpanel |
- Required | -
-
|
-
term |
- Do Not Name | -Since a term is usually the name for the role="definition" element, it could be confusing if the term itself also has a name. |
-
textbox |
- Required | -
-
|
-
time |
- Do Not Name | -Naming is not supported by assistive technologies. | -
timer |
- Discretionary | -
- Some screen readers announce the name of a timer element before announcing the content of the timer element.
- Thus, aria-label provides a method for prefacing the visible content of a timer element with text that is not displayed as part of the timer element.
- Using aria-label is functionally equivalent to providing off-screen text in the contents of the timer element, except off-screen text would be announced by screen readers that do not support aria-label on timer elements.
- |
-
toolbar |
- Recommended | -
-
|
-
tooltip |
- Required Only If Content Insufficient | -
-
|
-
tree |
- Required | -
-
|
-
treegrid |
- Required | -
-
|
-
treeitem |
- Required Only If Content Insufficient | -
-
|
-
- User agents construct an accessible name string for an element by walking through a list of potential naming methods and using the first that generates a name. - The algorithm they follow is defined in the accessible name specification. - It is roughly like the following: -
-The aria-labelledby
property is used if present.
If the name is still empty, the aria-label
property is used if present.
If the name is still empty, then host-language-specific attributes or elements are used if present. For HTML, these are, depending on the element:
-input
whose type
attribute is in the Button, Submit Button, or Reset Button statevalue
attribute.input
whose type
attribute is in the Image Button stateimg
area
alt
attribute. fieldset
legend
element.label
element(s).figure
figcaption
element.table
caption
element.If the name is still empty, then for elements with a role that supports naming from child content, the content of the element is used.
Finally, if the name is still empty, then other fallback host-language-specific attributes or elements are used if present. For HTML, these are, depending on the element:
-input
whose type
attribute is in the Text, Password, Search, Telephone, or URL statestextarea
title
attribute. Otherwise, the placeholder
attribute.input
whose type
attribute is in the Submit Button stateinput
whose type
attribute is in the Reset Button stateinput
whose type
attribute is in the Image Button statetitle
attribute. Otherwise, a localized string of the phrase "Submit Query".summary
title
attribute.- The final step is a fallback mechanism. Generally when labeling an element, use one of the non-fallback mechanisms. -
-
- When calculating a name from content, the user agent walks through all descendant nodes except in the cases of treeitem
and menuitem
as described below.
- And, when following references in an aria-labelledby
attribute, it similarly walks the tree of each referenced element.
- Thus, the naming algorithm is recursive.
- The following two sections explain non-recursive and recursive examples of how the algorithm works.
-
- When calculating a name from content for the treeitem
role, descendant content of child group
elements are not included.
- For example, in the following tree
, the name of the first tree item is Fruits
; Apples
, Bananas
, and Oranges
are automatically omitted.
-
<ul role="tree">
- <li role="treeitem">Fruits
- <ul role="group">
- <li role="treeitem">Apples</li>
- <li role="treeitem">Bananas</li>
- <li role="treeitem">Oranges</li>
- </ul>
- </li>
-</ul>
-
- Similarly, when calculating a name from content for the menuitem
role, descendant content of child menu
elements are not included.
- So, the name of the first parent menuitem
in the following menu
is Fruits
.
-
<ul role="menu">
- <li role="menuitem">Fruits
- <ul role="menu">
- <li role="menuitem">Apples</li>
- <li role="menuitem">Bananas</li>
- <li role="menuitem">Oranges</li>
- </ul>
- </li>
-</ul>
-
- Consider an input
element that has no associated label
element and only a name
attribute and so does not have an accessible name (do not do this):
<input name="code">
- If there is a placeholder
attribute, then it serves as a naming fallback mechanism (avoid doing this):
<input name="code"
- placeholder="One-time code">
-
- If there is also a title
attribute, then it is used as the accessible name instead of placeholder
, but it is still a fallback (avoid doing this):
<input name="code"
- placeholder="123456"
- title="One-time code">
-
- If there is also a label
element (recommended), then that is used as the accessible name, and the title
attribute is instead used as the accessible description:
<label>One-time code
- <input name="code"
- placeholder="123456"
- title="Get your code from the app.">
-</label>
-
- If there is also an aria-label
attribute (not recommended unless it adds clarity for assistive technology users), then that becomes the accessible name, overriding the label
element:
<label>Code
- <input name="code"
- aria-label="One-time code"
- placeholder="123456"
- title="Get your code from the app.">
-</label>
-
- If there is also an aria-labelledby
attribute, that wins over the other elements and attributes (the aria-label
attribute ought to be removed if it is not used):
<p>Please fill in your <span id="code-label">one-time code</span> to log in.</p>
-<p>
- <label>Code
- <input name="code"
- aria-labelledby="code-label"
- aria-label="This is ignored"
- placeholder="123456"
- title="Get your code from the app.">
- </label>
-</p>
- The accessible name calculation algorithm will be invoked recursively when necessary. An aria-labelledby
reference causes the algorithm to be invoked recursively, and when computing an accessible name from content the algorithm is invoked recursively for each child node.
In this example, the label for the button is computed by recursing into each child node, resulting in Move to trash
.
<button>Move to <img src="bin.svg" alt="trash"></button>
-
- When following an aria-labelledby
reference, the algorithm avoids following the same reference twice to avoid infinite loops.
In this example, the label for the button is computed by first following the aria-labelledby
reference to the parent element, and then computing the label for that element from the child nodes, first visiting the button
element again but ignoring the aria-labelledby
reference and instead using the aria-label
, and then visiting the next child (the text node). The resulting label is Remove meeting: Daily status report
.
<div id="meeting-1">
- <button aria-labelledby="meeting-1" aria-label="Remove meeting:">X</button>
- Daily status report
-</div>
- aria-describedby
- The aria-describedby
property works similarly to the aria-labelledby
property.
- For example, a button could be described by a sibling paragraph.
-
<button aria-describedby="trash-desc">Move to trash</button>
-...
-<p id="trash-desc">Items in the trash will be permanently removed after 30 days.</p>
-
- Descriptions are reduced to text strings. For example, if the description contains an HTML img
element, a text equivalent of the image is computed.
<button aria-describedby="trash-desc">Move to <img src="bin.svg" alt="trash"></button>
-...
-<p id="trash-desc">Items in <img src="bin.svg" alt="the trash"> will be permanently removed after 30 days.</p>
-
-
- As with aria-labelledby
, it is possible to reference an element using aria-describedby
even if that element is hidden.
- For example, a text field in a form could have a description that is hidden by default, but can be revealed on request using a disclosure widget.
- The description could also be referenced from the text field directly with aria-describedby
.
- In the following example, the accessible description for the input
element is Your username is the name that you use to log in to this service.
-
<label for="username">Username</label>
-<input id="username" name="username" aria-describedby="username-desc">
-<button aria-expanded="false" aria-controls="username-desc" aria-label="Help about username">?</button>
-<p id="username-desc" hidden>
- Your username is the name that you use to log in to this service.
-</p>
-
- In HTML, if the table
is named using aria-label
or aria-labelledby
, a child caption
element becomes an accessible description.
- For example, a preceding heading might serve as an appropriate accessible name, and the caption
element might contain a longer description.
- In such a situation, aria-labelledby
could be used on the table
to set the accessible name to the heading content and the caption
would become the accessible description.
-
<h2 id="events-heading">Upcoming events</h2>
-<table aria-labelledby="events-heading">
- <caption>
- Calendar of upcoming events, weeks 27 through 31, with each week starting with
- Monday. The first column is the week number.
- </caption>
- <tr><th>Week</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th><th>Sunday</th></tr>
- <tr><td>27</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
- <tr><td>28</td><td></td><td></td><td></td><td></td><td></td><td></td><td><a href="/events/9856">Crown Princess's birthday</a></td></tr>
- <tr><td>29</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
- <tr><td>30</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
- <tr><td>31</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
-</table>
- The HTML figure
element can get its accessible name from its figcaption
element, but it will not be used as the accessible description, even if it was not used as the accessible name. If the figcaption
element is appropriate as an accessible description, and the accessible name is set using aria-labelledby
or aria-label
, then the figcaption
can be explicitly set as the accessible description using the aria-describedby
attribute.
<h2 id="neutron">Neutron</h2>
-<figure aria-labelledby="neutron" aria-describedby="neutron-caption">
- <img src="neutron.svg" alt="Within the neutron are three quarks (blue 'u',
- red 'd', green 'd') that are interconnected.">
- <figcaption id="neutron-caption">
- The quark content of the neutron. The color assignment of individual quarks is
- arbitrary, but all three colors must be present. Forces between quarks are
- mediated by gluons.
- </figcaption>
-</figure>
- If an accessible description was not provided using the aria-describedby
attribute or one of the primary host-language-specific attributes or elements (e.g., the caption
element for table
), then, for HTML, if the element has a title
attribute, that is used as the accessible description.
A visible description together with aria-describedby
is generally recommended. If a description that is not visible is desired, then the title
attribute can be used, for any HTML element that can have an accessible description.
Note that the title
attribute might not be accessible to some users, in particular sighted users not using a screen reader and not using a pointing device that supports hover (e.g., a mouse).
For example, an input
element with input constrained using the pattern
attribute can use the title
attribute to describe what the expected input is.
<label> Part number:
- <input pattern="[0-9][A-Z]{3}" name="part"
- title="A part number is a digit followed by three uppercase letters."/>
-</label>
- The title
attribute in this case can be shown to the user as a tooltip when the user hovers or focuses the control, but also as part of the error message when the user agent validates the form, if the input
element's value doesn't match the pattern
.
As another example, a link can use the title
attribute to describe the link in more detail.
<a href="http://twitter.com/W3C"
- title="Follow W3C on Twitter">
- <img src="/2008/site/images/Twitter_bird_logo_2012.svg"
- alt="Twitter" class="social-icon" height="40" />
-</a>
- - Like the accessible name calculation, the accessible description calculation produces a text string. -
-
- The accessible description calculation algorithm is the same as the accessible name calculation algorithm except for a few branch points that depend on whether a name or description is being calculated.
- In particular, when accumulating text for an accessible description, the algorithm uses aria-describedby
instead of aria-labelledby
.
-
- User agents construct an accessible description string for an element by walking through a list of potential description methods and using the first that generates a description. - The algorithm they follow is defined in the accessible name specification. - It is roughly like the following: -
-The aria-describedby
property is used if present.
If the description is still empty, then host-language-specific attributes or elements are used if present, if it wasn't already used as the accessible name. For HTML, these are, depending on the element:
-input
whose type
attribute is in the Button, Submit Button, or Reset Button statevalue
attribute.summary
table
caption
element.Finally, if the description is still empty, then other host-language-specific attributes or elements are used if present, if it wasn't already used for the accessible name. For HTML, this is the title
attribute.
- 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. -
-This section covers:
-Work to complete this section is tracked by issue 217.
-- 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. -
- -- 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:
- -in composite widgets where only one element may be selected, such as a tablist or single-select listbox, moving the focus may also cause the focused element to become the selected element. This is called having selection follow focus. Having selection follow focus is often beneficial to users, but in some circumstances, it is extremely detrimental to accessibility.
-- For example, in a tablist, the selected state is used to indicate which panel is displayed. - So, when selection follows focus in a tablist, moving focus from one tab to another automatically changes which panel is displayed. - If the content of panels is present in the DOM, then displaying a new panel is nearly instantaneous. - A keyboard user who wishes to display the fourth of six tabs can do so with 3 quick presses of the right arrow. - And, a screen reader user who perceives the labels on tabs by navigating through them may efficiently read through the complete list without any latency. -
-However, if displaying a new panel causes a network request and possibly a page refresh, the effect of having selection automatically focus can be devastating to the experience for keyboard and screen reader users. In this case, displaying the fourth tab or reading through the list becomes a tedious and time-consuming task as the user experiences significant latency with each movement of focus. Further, if displaying a new tab refreshes the page, then the user not only has to wait for the new page to load but also return focus to the tab list.
-- When selection does not follow focus, the user changes which element is selected by pressing the Enter or Space key. -
-As explained in section , all interactive UI components need to be reachable via 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 [[SVG2]] 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 macOS, where it includes only form elements. - macOS 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.
- -- 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 receives 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. -
- -- 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. -
- -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.tabindex="-1"
on the element that has tabindex="0"
.tabindex="0"
on the element that will become focused as a result of the key event.element.focus()
, on the element that has tabindex="0"
.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. -
-- 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.
- -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.
- - 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. -
-- 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. -
- -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 .
-- The following key assignments can be used in any context where their conventionally associated functions are appropriate. - While the assignments associated with Windows and Linux platforms can be implemented and used in browsers running in macOS, - replacing them with macOS assignments in browsers running on a macOS device can make the keyboard interface more discoverable and intuitive for those users. - In some cases, it may also help avoid system or browser keyboard conflicts. -
-Function | -Windows/Linux Key | -macOS Key | -
---|---|---|
open context menu | -Shift + F10 | -- |
Copy to clipboard | -Control + C | -Command + C | -
Paste from clipboard | -Control + V | -Command + V | -
Cut to clipboard | -Control + X | -Command + X | -
undo last action | -Control + Z | -Command + Z | -
Redo action | -Control + Y | -Command + Shift + Z | -
- 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: -
-This section explains the following factors when determining which elements and features to assign keyboard shortcuts and what behavior to give each shortcut:
- -- 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: -
- -The following conventions may help identify the most advantageous behavior for a keyboard shortcut.
- -Work to draft content for this section is tracked in issue 219.
-The first goal when designing a keyboard interface is simple, efficient, 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:
- -When choosing the keys to assign to a shortcut, there are many factors to consider.
-- 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. -
-It is essential to avoid conflicts with keys that perform system level functions, such as application and window management and display and sound control. In general, this can be achieved by refraining from the following types of assignments.
- -- In addition, there are some important application level features that most applications, including browsers, generally support. - These include: -
- -- 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.
- -While there is considerable similarity among browser keyboard schemes, the patterns within the schemes are less homogenous. 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:
- -- 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: -
- -For example, consider a save function that is available when the focus is in an editor. Most browsers use ... to be continued ...
-- To fully present and describe a grid or table, in addition to parsing the headers, rows, and cells using the roles described in the - grid pattern or table pattern, - assistive technologies need to be able to determine: -
-- Browsers automatically populate their accessibility tree with the number of rows and columns in a grid or table based on the rendered DOM. - However, there are many situations where the DOM does not contain the whole grid or table, such as when the data set is too large to fully render. - Additionally, some of this information, like skipped columns or rows and how data is sorted, cannot be derived from the DOM structure. -
-The below sections explain how to use the following properties that ARIA provides for grid and table accessibility.
-Property | -Definition | -
---|---|
aria-colcount |
- Defines the total number of columns in a table , grid , or treegrid . |
-
aria-rowcount |
- Defines the total number of rows in a table , grid , or treegrid . |
-
aria-colindex |
-
-
|
-
aria-rowindex |
-
-
|
-
aria-colspan |
- Defines the number of columns spanned by a cell or gridcell within a table , grid , or treegrid . |
-
aria-rowspan |
- Defines the number of rows spanned by a cell or gridcell within a table , grid , or treegrid . |
-
aria-sort |
- Indicates if items in a row or column are sorted in ascending or descending order. | -
aria-rowcount
and aria-rowindex
- When the number of rows represented by the DOM structure is not the total number of rows available for a table, grid, or treegrid,
- the aria-rowcount
property is used to communicate the total number of rows available,
- and it is accompanied by the aria-rowindex
property to identify the row indices of the rows that are present in the DOM.
-
- The aria-rowcount
is specified on the element with the table
, grid
, or treegrid
role.
- Its value is an integer equal to the total number of rows available, including header rows.
- If the total number of rows is unknown, a value of -1
may be specified.
- Using a value of -1
indicates that more rows are available to include in the DOM without specifying the size of the available supply.
-
- When aria-rowcount
is used on a table
, grid
, or treegrid
,
- a value for aria-rowindex
property is specified on each of its descendant rows, including any header rows.
- The value of aria-rowindex
is an integer that is:
-
aria-rowindex
on any previous rows.
- WARNING! Missing or inconsistent values of aria-rowindex
could have devastating effects on assistive technology behavior.
- For example, specifying an invalid value for aria-rowindex
or setting it on some but not all rows in a table, could cause screen reader table reading functions to skip rows or simply stop functioning.
-
- The following code demonstrates the use of aria-rowcount
and aria-rowindex
properties on a table containing a hypothetical class list.
-
-
- <!--
- aria-rowcount tells assistive technologies the actual size of the grid
- is 463 rows even though only 4 rows are present in the markup.
- -->
- <table role="grid" aria-rowcount="463">
- aria-label="Student roster for history 101"
- <thead>
- <tr aria-rowindex="1">
- <th>Last Name</th>
- <th>First Name</th>
- <th>E-mail</th>
- <th>Major</th>
- <th>Minor</th>
- <th>Standing</th>
- </tr>
- </thead>
- <tbody>
- <!--
- aria-rowindex tells assistive technologies that this
- row is row 51 in the grid of 463 rows.
- -->
- <tr aria-rowindex="51">
- <td>Henderson</td>
- <td>Alan</td>
- <td>ahederson56@myuniveristy.edu</td>
- <td>Business</td>
- <td>Spanish</td>
- <td>Junior</td>
- </tr>
- <!--
- aria-rowindex tells assistive technologies that this
- row is row 52 in the grid of 463 rows.
- -->
- <tr aria-rowindex="52">
- <td>Henderson</td>
- <td>Alice</td>
- <td>ahederson345@myuniveristy.edu</td>
- <td>Engineering</td>
- <td>none</td>
- <td>Sophomore</td>
- </tr>
- <!--
- aria-rowindex tells assistive technologies that this
- row is row 53 in the grid of 463 rows.
- -->
- <tr aria-rowindex="53">
- <td>Henderson</td>
- <td>Andrew</td>
- <td>ahederson75@myuniveristy.edu</td>
- <td>General Studies</td>
- <td>none</td>
- <td>Freshman</td>
- </tr>
- </tbody>
- </table>
-
-
- aria-colcount
and aria-colindex
- When the number of columns represented by the DOM structure is not the total number of columns available for a table, grid, or treegrid,
- the aria-colcount
property is used to communicate the total number of columns available,
- and it is accompanied by the aria-colindex
property to identify the column indices of the columns that are present in the DOM.
-
- The aria-colcount
is specified on the element with the table
, grid
, or treegrid
role.
- Its value is an integer equal to the total number of columns available.
- If the total number of columns is unknown, a value of -1
may be specified.
- Using a value of -1
indicates that more columns are available to include in the DOM without specifying the size of the available supply.
-
- When aria-colcount
is used on a table
, grid
, or treegrid
,
- a value for aria-colindex
property is either specified on each of its descendant rows or on every cell in each descendant row, depending on whether the columns are contiguous as described below.
- The value of aria-colindex
is an integer that is:
-
- WARNING! Missing or inconsistent values of aria-colindex
could have devastating effects on assistive technology behavior.
- For example, specifying an invalid value for aria-colindex
or setting it on some but not all cells in a row, could cause screen reader table reading functions to skip cells or simply stop functioning.
-
aria-colindex
When Column Indices Are Contiguous
- When all the cells in a row have column index numbers that are consecutive integers,
- aria-colindex
can be set on the row element with a value equal to the index number of the first column in the set.
- Browsers will then compute a column number for each cell in the row.
-
- The following code shows a grid with 16 columns, of which columns 2 through 5 are displayed to the user.
- Because the set of columns is contiguous, aria-colindex
can be placed on each row.
-
-
-<div role="grid" aria-colcount="16">
- <div role="rowgroup">
- <div role="row" aria-colindex="2">
- <span role="columnheader">First Name</span>
- <span role="columnheader">Last Name</span>
- <span role="columnheader">Company</span>
- <span role="columnheader">Address</span>
- </div>
- </div>
- <div role="rowgroup">
- <div role="row" aria-colindex="2">
- <span role="gridcell">Fred</span>
- <span role="gridcell">Jackson</span>
- <span role="gridcell">Acme, Inc.</span>
- <span role="gridcell">123 Broad St.</span>
- </div>
- <div role="row" aria-colindex="2">
- <span role="gridcell">Sara</span>
- <span role="gridcell">James</span>
- <span role="gridcell">Acme, Inc.</span>
- <span role="gridcell">123 Broad St.</span>
- </div>
- …
- </div>
-</div>
-
-
- aria-colindex
When Column Indices Are Not Contiguous
- When the cells in a row have column index numbers that are not consecutive integers, aria-colindex
needs to be set on each cell in the row.
- The following example shows a grid for an online grade book where the first two columns contain a student name and subsequent columns contain scores.
- In this example, the first two columns with the student name are shown, but the score columns have been scrolled to show columns 10 through 13.
- Columns 3 through 9 are not visible so are not in the DOM.
-
-
- <table role="grid" aria-rowcount="463" aria-colcount="13">
- aria-label="Student grades for history 101"
- <!--
- aria-rowcount and aria-colcount tell assistive technologies
- the actual size of the grid is 463 rows by 13 columns,
- which is not the number rows and columns found in the markup.
- -->
- <thead>
- <tr aria-rowindex="1">
- <!--
- aria-colindex tells assistive technologies that the
- following columns represent columns 1 and 2 of the total data set.
- -->
- <th aria-colindex="1">Last Name</th>
- <th aria-colindex="2">First Name</th>
- <!--
- aria-colindex tells users of assistive technologies that the
- following columns represent columns 10, 11, 12, and 13 of
- the overall data set of grades.
- -->
- <th aria-colindex="10">Homework 4</th>
- <th aria-colindex="11">Quiz 2</th>
- <th aria-colindex="12">Homework 5</th>
- <th aria-colindex="13">Homework 6</th>
- </tr>
- </thead>
- <tbody>
- <tr aria-rowindex="50">
- <!--
- every cell needs to define the aria-colindex attribute
- -->
- <td aria-colindex="1">Henderson</td>
- <td aria-colindex="2">Alan</td>
- <td aria-colindex="10">8</td>
- <td aria-colindex="11">25</td>
- <td aria-colindex="12">9</td>
- <td aria-colindex="13">9</td>
- </tr>
- <tr aria-rowindex="51">
- <td aria-colindex="1">Henderson</td>
- <td aria-colindex="2">Alice</td>
- <td aria-colindex="10">10</td>
- <td aria-colindex="11">27</td>
- <td aria-colindex="12">10</td>
- <td aria-colindex="13">8</td>
- </tr>
- <tr aria-rowindex="52">
- <td aria-colindex="1">Henderson</td>
- <td aria-colindex="2">Andrew</td>
- <td aria-colindex="10">9</td>
- <td aria-colindex="11">0</td>
- <td aria-colindex="12">29</td>
- <td aria-colindex="13">8</td>
- </tr>
- </tbody>
- </table>
-
-
- aria-colspan
and aria-rowspan
- For tables, grids, and treegrids created using elements other than HTML table
elements,
- row and column spans are defined with the aria-rowspan
and aria-colspan
properties.
-
The value of aria-colspan
is an integer that is:
The value of aria-rowspan
is an integer that is:
- The following example grid has a two row header. - The first two columns have headers that span both rows of the header. - The subsequent 6 columns are grouped into 3 pairs with headers in the first row that each span two columns. -
-
-
- <div role="grid" aria-rowcount="463">
- aria-label="Student grades for history 101"
- <div role="rowgroup">
- <div role="row" aria-rowindex="1">
- <!--
- aria-rowspan and aria-colspan provide
- assistive technologies with the correct data cell header information
- when header cells span more than one row or column.
- -->
- <span role="columnheader" aria-rowspan="2">Last Name</span>
- <span role="columnheader" aria-rowspan="2">First Name</span>
- <span role="columnheader" aria-colspan="2">Test 1</span>
- <span role="columnheader" aria-colspan="2">Test 2</span>
- <span role="columnheader" aria-colspan="2">Final</span>
- </div>
- <div role="row" aria-rowindex="2">
- <span role="columnheader">Score</span>
- <span role="columnheader">Grade</span>
- <span role="columnheader">Score</span>
- <span role="columnheader">Grade</span>
- <span role="columnheader">Total</span>
- <span role="columnheader">Grade</span>
- </div>
- </div>
- <div role="rowgroup">
- <div role="row" aria-rowindex="50">
- <span role="cell">Henderson</span>
- <span role="cell">Alan</span>
- <span role="cell">89</span>
- <span role="cell">B+</span>
- <span role="cell">72</span>
- <span role="cell">C</span>
- <span role="cell">161</span>
- <span role="cell">B-</span>
- </div>
- <div role="row" aria-rowindex="51">
- <span role="cell">Henderson</span>
- <span role="cell">Alice</span>
- <span role="cell">94</span>
- <span role="cell">A</span>
- <span role="cell">86</span>
- <span role="cell">B</span>
- <span role="cell">180</span>
- <span role="cell">A-</span>
- </div>
- <div role="row" aria-rowindex="52">
- <span role="cell">Henderson</span>
- <span role="cell">Andrew</span>
- <span role="cell">82</span>
- <span role="cell">B-</span>
- <span role="cell">95</span>
- <span role="cell">A</span>
- <span role="cell">177</span>
- <span role="cell">B+</span>
- </div>
- </div>
- </div>
-
-
-
- Note: When using HTML table
elements,
- use the native semantics of the th
and td
elements to define row and column spans
- by using the rowspan
and colspan
attributes.
-
aria-sort
- When rows or columns are sorted, the aria-sort
property can be applied to a column or row header to indicate the sorting method.
- The following table describes allowed values for aria-sort
.
-
Value | -Description | -
---|---|
ascending |
- Data are sorted in ascending order. | -
descending |
- Data are sorted in descending order. | -
other |
- Data are sorted by an algorithm other than ascending or descending. | -
none |
- Default (no sort applied). | -
- It is important to note that ARIA does not provide a way to indicate levels of sort for data sets that have multiple sort keys.
- Thus, there is limited value to applying aria-sort
with a value other than none
to more than one column or row.
-
The following example grid uses aria-sort
to indicate the rows are sorted from the highest "Quiz 2" score to the lowest "Quiz 2" score.
-
- <table role="grid" aria-rowcount="463" aria-colcount="13"
- aria-label="Student grades for history 101">
- <thead>
- <tr aria-colindex="10" aria-rowindex="1">
- <th>Homework 4</th>
- <!--
- aria-sort indicates the column with the heading
- "Quiz 2" has been used to sort the rows of the grid.
- -->
- <th aria-sort="descending">Quiz 2</th>
- <th>Homework 5</th>
- <th>Homework 6</th>
- </tr>
- </thead>
- <tbody>
- <tr aria-colindex="10" aria-rowindex="50">
- <td>8</td>
- <td>30</td>
- <td>9</td>
- <td>9</td>
- </tr>
- <tr aria-colindex="10" aria-rowindex="51">
- <td>10</td>
- <td>29</td>
- <td>10</td>
- <td>8</td>
- </tr>
- <tr aria-colindex="10" aria-rowindex="52">
- <td>9</td>
- <td>9</td>
- <td>27</td>
- <td>6</td>
- </tr>
- <tr aria-colindex="10" aria-rowindex="53">
- <td>9</td>
- <td>10</td>
- <td>26</td>
- <td>8</td>
- </tr>
- <tr aria-colindex="10" aria-rowindex="54">
- <td>9</td>
- <td>7</td>
- <td>24</td>
- <td>6</td>
- </tr>
- </tbody>
- </table>
-
-
-
-
- presentation
Role
- While ARIA is primarily used to express semantics, there are some situations where hiding an
- element’s semantics from assistive technologies is helpful. This is done with the
- presentation
- role, which declares that an element is being used only for presentation and therefore does
- not have any accessibility semantics. The ARIA 1.1 specification also includes role
- none,
- which serves as a synonym for presentation
.
-
- For example, consider a tabs widget built using an HTML ul
element.
-
- <ul role="tablist"> - <li role="presentation"> - <a role="tab" href="#">Tab 1</a> - </li> - <li role="presentation"> - <a role="tab" href="#">Tab 2</a> - </li> - <li role="presentation"> - <a role="tab" href="#">Tab 3</a> - </li> - </ul> --
- Because the list is declared to be a tablist, the list items are not in a list context. It
- could confuse users if an assistive technology were to render those list items. Applying role
- presentation
to the li
elements tells browsers to leave those
- elements out of their accessibility tree. Assistive technologies will thus be unaware of the
- list item elements and see the tab elements as immediate children of the tablist.
-
- Three common uses of role presentation
are:
-
presentation
-
- When role="presentation"
is specified on an element, if a
- condition that requires a browser to ignore the presentation
role
- does not exist, it has the following three effects.
-
display: none
or has aria-hidden="true"
.
- presentation
is applied to a ul
or ol
element, each child li
element inherits the presentation
role because ARIA requires the listitem
elements to have the parent list
element. So, the li
elements are not exposed to assistive technologies, but elements contained inside of those li
elements, including nested lists, are visible to assistive technologies. presentation
is applied to a table
element,
- the descendant caption
, thead
, tbody
, tfoot
,
- tr
, th
, and td
- elements inherit role presentation
and are thus not exposed to assistive technologies.
- But, elements inside of the th
and td
elements, including nested tables, are exposed to assistive technologies.
- presentation
to be Ignored
-
- Browsers ignore role="presentation"
, and it therefore has no effect, if either of the following are true about the element to which it is applied:
tabindex
attribute.aria-label
.
- presentation
Role
- This code:
-- <ul role="presentation"> - <li>Date of birth:</li> - <li>January 1, 3456</li> - </ul> --
when parsed by a browser, is equivalent to the following from the perspective of a screen reader or other assistive technology that relies on the browser's accessibility tree: -
-- <div>Date of birth:</div> - <div>January 1, 3456</div> --
- There are some types of user interface components that, when represented in a platform
- accessibility API, can only contain text. For example, accessibility APIs do not have a way of
- representing semantic elements contained in a button. To deal with this limitation, WAI-ARIA
- requires browsers to automatically apply role presentation
to all descendant
- elements of any element with a role that cannot support semantic children.
-
The roles that require all children to be presentational are:
-For instance, consider the following tab element, which contains a heading.
-- <li role="tab"><h3>Title of My Tab</h3></li> --
- Because WAI-ARIA requires descendants of tab to be presentational, - the following code is equivalent. -
-- <li role="tab"><h3 role="presentation">Title of My Tab</h3></li> --
- And, from the perspective of anyone using a technology that relies on an accessibility API, such as a screen reader, - the heading does not exist since the previous code is equivalent to the following. -
-- <li role="tab">Title of My Tab</li> --
- See the
-
- section about role presentation
-
- for a detailed explanation of what it does.
-
- ARIA provides a set of roles that convey the accessibility semantics of structures on a page. - These roles express the meaning that is conveyed by the layout and appearance of elements that organize and structure content, such as headings, lists, and tables. -
-
- some host languages, such as HTML, include elements that express the same semantics as an ARIA role.
- For instance, the HTML <p>
element is mapped to accessibility APIs in exactly the same way as <div role="paragraph">
.
- The ARIA and HTML specifications refer to this mapping of HTML elements to ARIA attributes as implied semantics, i.e., the implied ARIA role of the HTML <p>
element is paragraph
.
-
- When developing HTML, it is important to use native HTML elements where ever possible. - Do not use an ARIA role or property if it is possible to use an HTML element that has equivalent semantics. - Circumstances where it is appropriate to use ARIA attributes instead of equivalent HTML are: -
-The following table lists all structural roles defined in ARIA 1.2.
-ARIA Role | -HTML Equivalent | -
---|---|
application | No equivalent element |
article | article |
blockquote | blockquote |
caption | caption |
cell | td |
code | code |
columnheader | th |
definition | dd |
deletion | del |
directory | No equivalent element |
document | No equivalent element |
emphasis | em |
feed | No equivalent element |
figure | figure |
generic | div, span |
group | No equivalent element |
heading with aria-level="N" where N is 1, 2, 3, 4, 5, or 6 | h1, h2, h3, h4, h5, h6 |
insertion | ins |
img | img |
list | ul, ol |
listitem | li |
math | No equivalent element |
none | No equivalent element |
note | No equivalent element |
presentation | No equivalent element |
paragraph | p |
row | tr |
rowgroup | tbody, thead, tfoot |
rowheader | th |
separator (when not focusable) | hr |
strong | strong |
subscript | sub |
superscript | sup |
table | table |
term | dfn |
time | time |
toolbar | No equivalent element |
tooltip | No equivalent element |
- APG 1.1 supported ARIA 1.1, and this version, APG 1.2, includes changes to support version 1.2 of the ARIA specification. - It also includes nearly 200 significant updates to improve the quality and breadth of content. - A detailed log of all changes is available on the wiki of the w3c/aria-practices GitHub repository. - Highlights of major changes to support ARIA 1.2 as well as some of the improvements include the following. -
-Jump tomenu, a button to open the example in CodePen, and added a prominently placed warning with guidance about testing before re-using example code.
Comprehensive lists of closed issues included in APG 1.2 release 1 are tracked in the following GitHub milestones.
-- This version of the ARIA Authoring Practices Guide is dedicated to the memory of Carolyn MacLeod whose contributions are visible throughout the entire guide. - She was dedicated to all aspects of the work of the APG Task Force from writing code and suggesting editorial revisions to testing examples with assistive technologies. -
-- While WAI-ARIA Authoring Practices 1.1 is the work of the entire Authoring Practices Task Force and also benefits from many people throughout the open source community who both contribute significant work and provide valuable feedback, - special thanks goes to the following people who provided distinctly large portions of the content and code in version 1.1. -
-+ + Replace this paragraph with an overview of the example that is something like the following. The below example section demonstrates a simple checkbox that implements the + design pattern for checkbox. + This example uses ... summarize salient techniques ) +
+Similar examples include:
+This is the place where the reader will experience the functioning example.
+Optional section: If appropriate, please replace this content with a list of any special or noteworthy accessibility features demonstrated in this implementation, such as:
+Key | +Function | +
---|---|
KeyName | ++ Description of key function. + + | +
KeyName | +
+
|
+
Role | +Attribute | +Element | +Usage | +
---|---|---|---|
RoleName |
+ + | HTML_ELEMENT |
+ Describe usage/purpose, e.g., indicates the focusable element that serves as the ... | +
+ + | +
+ AttributeName=
+ |
+ HTML_ELEMENT |
+
+
|
+
+
+
+ + The ARIA Authoring Practices Guide (APG) explains how to create accessible web experiences for users of assistive technologies and keyboard interfaces by developing web sites that properly convey accessibility semantics and implement common keyboard conventions. + It also provides guidance on some closely related topics, such as supporting operating system settings for high contrast and reduced motion. +
++ Accessibility semantics refer to the meaning of user interface elements that need to be conveyed to assistive technology users in order for those users to understand and use the elements. + For example, people who can visually perceive a search icon button understand the element can be activated to perform a search by the way it is styled and positioned. + To make that icon accessible to a screen reader user, one of the semantics that needs to be communicated is that the element represents an interactive button. + In addition, keyboard accessibility requires the button to be focusable, and keyboard conventions call for pressing Enter or Space to activate the button when it is focused. + The APG describes how to convey accessibility semantics and implement keyboard accessibility for many common design patterns, ranging from typical buttons and popup menus to complex tree grids. + It also explains essential practices related to these patterns, such as how to convey web page structure with ARIA landmark regions and effectively utilize the many ways of encoding accessible names. +
++ The APG is organized into two major sections: patterns and practices. + Each pattern explains how to make a common user interface element, such as a button, menu, or dialog, accessible, and provides functional example implementations of the pattern. + The practices section gives in-depth explanation of how to satisfy a variety of accessibility needs that surface when making rich internet application experiences accessible. + For instance, the practices section on providing accessible names and descriptions gives detailed descriptions of seven different naming techniques as well as a table providing guidance for naming more than 80 types of elements. +
++ The APG assumes basic understanding of web development, especially of HTML and CSS. + It may be particularly useful to designers and engineers who are working on site design systems and component libraries. + However, it is important to understand that the APG only covers a portion of what is needed to create accessible experiences. + To understand accessibility more broadly, it is advisable to start with the WAI Accessibility Fundamentals and WAI Overview of Design and Development. +
+
+ The accessibility semantics used in the APG patterns and described in APG practices are defined in the
+ WAI-ARIA 1.2 Specification.
+ That is, the ARIA specification standardizes the meaning of the attributes that describe elements and their states to assistive technologies, such as the meaning of role="button"
.
+ These attributes and other features required to make sites usable by people who rely on assistive technologies or keyboard navigation are not natively included in the languages used to create web sites, such as HTML, JavaScript, CSS, and SVG.
+ The W3C Web Accessibility Initiative's (WAI) Accessible Rich Internet Applications working group (ARIA WG) is addressing these deficiencies through several W3C standards efforts.
+ The WAI-ARIA Overview
+ provides additional background on WAI-ARIA, summarizes those efforts, and lists the other documents included in the WAI-ARIA suite.
+
+ APG 1.1 supported ARIA 1.1, and this version, APG 1.2, includes changes to support version 1.2 of the ARIA specification. + It also includes nearly 200 significant updates to improve the quality and breadth of content. + A detailed log of all changes is available on the wiki of the w3c/aria-practices GitHub repository. + Highlights of major changes to support ARIA 1.2 as well as some of the improvements include the following. +
+Jump tomenu, a button to open the example in CodePen, and added a prominently placed warning with guidance about testing before re-using example code.
Comprehensive lists of closed issues included in APG 1.2 release 1 are tracked in the following GitHub milestones.
++ This version of the ARIA Authoring Practices Guide is dedicated to the memory of Carolyn MacLeod whose contributions are visible throughout the entire guide. + She was dedicated to all aspects of the work of the APG Task Force from writing code and suggesting editorial revisions to testing examples with assistive technologies. +
++ While WAI-ARIA Authoring Practices 1.1 is the work of + the entire Authoring Practices Task Force and also benefits from many people throughout the open source + community who both contribute significant work and provide valuable feedback, special thanks goes to the + following people who provided distinctly large portions of the content and code in version 1.1. +
++ The APG Task Force uses the reports on this page to help plan content improvements. + The reports provide data about the scope and quality of content in the APG. + The data delineates: +
++ The data in the reports are generated by a script + that is run by a GitHub action workflow + when the main branch of the aria-practices repository is updated. + The script will indicate that an ARIA attribute has guidance in a pattern or practice if any of the following conditions are met: +
+h2
-h6
) within the content of a pattern or practice.data-aria-roles
or data-aria-props
attribute specified on a heading within a pattern or practice.
+ These data attributes may contain a space separated list of values.
+ + If either of the data attributes is specified on a heading, the content of that heading will not be processed. + In the generated report, the suffix "(D)" indicates a reference came from a data attribute, otherwise the reference came from the text content of a heading. +
++ The following files and reports are generated: +
+application
caption
code
definition
deletion
directory
document
emphasis
figure
generic
heading
img
input
insertion
list
listitem
log
marquee
math
note
paragraph
progressbar
rowheader
scrollbar
searchbox
status
term
textbox
timer
Role | +Guidance | +Example | +
---|---|---|
alertdialog |
+ + | Alert Dialog + | +
article |
+ + | Feed + | +
columnheader |
+ + | Table + | +
complementary |
+ Complementary + | +Complementary Landmark + | +
feed |
+ Feed Pattern + | +Feed + | +
link |
+ Link Pattern + | +Link + | +
main |
+ Main + | +Main Landmark + | +
menuitemcheckbox |
+ + | Editor Menubar + | +
rowgroup |
+ + | Table + | +
search |
+ Search + | +Search Landmark + | +
separator |
+ + | Editor Menubar + | +
tooltip |
+ Tooltip Pattern + | ++ |
treegrid |
+ Treegrid Pattern + | +Treegrid Email Inbox + | +
aria-details
aria-dropeffect
aria-errormessage
aria-flowto
aria-grabbed
aria-invalid
aria-keyshortcuts
aria-multiline
aria-placeholder
aria-readonly
aria-relevant
aria-required
Property or State | +Guidance | +Example | +
---|---|---|
aria-atomic |
+ + | Alert + | +
aria-busy |
+ + | Feed + | +
aria-colcount |
+ Using aria-colcount and aria-colindex + | +Data Grid + | +
aria-colspan |
+ Defining cell spans using aria-colspan and aria-rowspan + | ++ |
aria-multiselectable |
+ + | Listboxes with Rearrangeable Options + | +
aria-orientation |
+ + | Vertical Temperature Slider + | +
aria-owns |
+ + | Navigation Treeview + | +
aria-rowspan |
+ Defining cell spans using aria-colspan and aria-rowspan + | ++ |
Total Examples | +60 | +
---|---|
High Contrast Documentation | +31 | +
Uses SVG | +33 | +
Uses forced-color-adjust on SVG |
+ 13 | +
Uses event.KeyCode |
+ 20 | +
Uses event.which |
+ 12 | +
Use Class | +31 | +
Use Prototype | +23 | +
Mouse Events | +16 | +
Pointer Events | +59 | +
Example | +Created Using | +Uses event.keyCode |
+ Uses event.which |
+ High Contrast Documentation | +Example Code ID | +Roles in Javascript and HTML | +Roles in Documentation | +aria-* Attributes in Javascript and HTML | +aria-* Attributes in Documentation | +Differences between the documentation and the source code. | +
---|---|---|---|---|---|---|---|---|---|---|
Accordion | +class | ++ | + | + | ex1 | +4 | +1 | +9 | +3 | +heading,menu,menuitem,aria-busy,aria-haspopup,aria-hidden,aria-label,aria-required,aria-roledescription | +
Alert | ++ | + | + | + | ex1 | +4 | +1 | +7 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription,aria-live,aria-atomic | +
Alert Dialog | +prototype | +Yes | +Yes | ++ | ex_alertdialog | +5 | +2 | +11 | +4 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-hidden,aria-label,aria-roledescription | +
Breadcrumb | ++ | + | + | + | ex1 | +4 | +0 | +8 | +2 | +heading,menu,menuitem,navigation,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-labelledby,aria-roledescription | +
Button (IDL Version) | ++ | Yes | ++ | + | example | +4 | +1 | +9 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Button | ++ | Yes | ++ | + | example | +4 | +1 | +9 | +1 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-hidden,aria-label,aria-labelledby,aria-roledescription | +
Auto-Rotating Image Carousel with Buttons for Slide Control | +prototype | ++ | + | + | ex1 | +5 | +2 | +8 | +4 | +heading,menu,menuitem,aria-busy,aria-expanded,aria-haspopup,aria-labelledby | +
Auto-Rotating Image Carousel with Tabs for Slide Control | +prototype | ++ | + | Yes | +ex1 | +7 | +4 | +9 | +5 | +heading,menu,menuitem,aria-busy,aria-expanded,aria-haspopup,aria-labelledby | +
Checkbox (Mixed-State) | +class | ++ | + | Yes | +ex1 | +4 | +1 | +8 | +2 | +heading,menu,menuitem,aria-busy,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Checkbox (Two State) | +class | ++ | + | Yes | +ex1 | +5 | +2 | +8 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Editable Combobox With Both List and Inline Autocomplete | +class | ++ | + | Yes | +ex1 | +6 | +3 | +11 | +6 | +heading,menu,menuitem,aria-busy,aria-haspopup,aria-hidden,aria-labelledby,aria-roledescription | +
Editable Combobox With List Autocomplete | +class | ++ | + | Yes | +ex1 | +6 | +3 | +11 | +6 | +heading,menu,menuitem,aria-busy,aria-haspopup,aria-hidden,aria-labelledby,aria-roledescription | +
Editable Combobox without Autocomplete | +class | ++ | + | Yes | +ex1 | +6 | +3 | +11 | +6 | +heading,menu,menuitem,aria-busy,aria-haspopup,aria-hidden,aria-labelledby,aria-roledescription | +
Date Picker Combobox | +class | ++ | + | Yes | +ex1 | +7 | +3 | +13 | +10 | +gridcell,heading,menu,menuitem,aria-busy,aria-hidden,aria-roledescription | +
Select-Only Combobox | +prototype | ++ | + | + | ex1 | +5 | +3 | +9 | +5 | +heading,menu,menuitem,option,aria-busy,aria-haspopup,aria-label,aria-roledescription | +
Editable Combobox with Grid Popup | +prototype | +Yes | +Yes | ++ | ex1 | +5 | +4 | +10 | +7 | +heading,menu,menuitem,row,gridcell,aria-busy,aria-label,aria-roledescription | +
Date Picker Dialog | +prototype | ++ | Yes | +Yes | +example | +6 | +2 | +11 | +6 | +gridcell,heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-roledescription | +
Modal Dialog | +prototype | +Yes | +Yes | ++ | ex1 | +4 | +1 | +9 | +3 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Disclosure (Show/Hide) for Answers to Frequently Asked Questions | +class | ++ | + | Yes | +ex1 | +3 | +0 | +7 | +2 | +heading,menu,menuitem,aria-busy,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Disclosure (Show/Hide) for Image Description | +class | ++ | + | Yes | +ex1 | +3 | +0 | +7 | +2 | +heading,menu,menuitem,aria-busy,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Disclosure Navigation Menu with Top-Level Links | +class, prototype | ++ | + | + | ex1 | +7 | +0 | +8 | +3 | +banner,contentinfo,heading,menu,menuitem,navigation,region,aria-busy,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Disclosure Navigation Menu | +class, prototype | ++ | + | Yes | +ex1 | +5 | +0 | +8 | +3 | +heading,menu,menuitem,navigation,region,aria-busy,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Feed | ++ | + | + | + | ex1 | +3 | +2 | +7 | +5 | +heading,menu,menuitem,feed,article,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription,aria-describedby,aria-posinset,aria-setsize | +
Feed Display | +prototype | +Yes | +Yes | ++ | not found | +0 | +0 | +6 | +0 | +aria-busy,aria-describedby,aria-label,aria-labelledby,aria-posinset,aria-setsize | +
Advanced Data Grid | +prototype | +Yes | +Yes | ++ | ex1 | +3 | +0 | +10 | +0 | +heading,menu,menuitem,aria-busy,aria-colindex,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription,aria-rowindex,aria-sort | +
Data Grid | +prototype | +Yes | +Yes | ++ | ex1 | +5 | +1 | +12 | +6 | +button,heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Layout Grid | +prototype | +Yes | +Yes | ++ | ex1 | +8 | +3 | +13 | +3 | +button,heading,menu,menuitem,region,aria-busy,aria-colindex,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-live,aria-relevant,aria-roledescription,aria-sort | +
Link | ++ | Yes | ++ | + | not found | +4 | +1 | +7 | +1 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-labelledby,aria-roledescription | +
(Deprecated) Collapsible Dropdown Listbox | +prototype | +Yes | +Yes | ++ | ex | +5 | +2 | +12 | +5 | +heading,menu,menuitem,aria-busy,aria-controls,aria-disabled,aria-keyshortcuts,aria-label,aria-multiselectable,aria-roledescription | +
Listbox with Grouped Options | +prototype | +Yes | +Yes | ++ | ex | +7 | +3 | +12 | +3 | +heading,menu,menuitem,presentation,aria-busy,aria-controls,aria-disabled,aria-expanded,aria-haspopup,aria-keyshortcuts,aria-label,aria-multiselectable,aria-roledescription | +
Listboxes with Rearrangeable Options | +prototype | +Yes | +Yes | ++ | ex1 | +6 | +2 | +13 | +4 | +heading,menu,menuitem,toolbar,aria-busy,aria-controls,aria-disabled,aria-expanded,aria-haspopup,aria-keyshortcuts,aria-label,aria-live,aria-roledescription | +
Scrollable Listbox | +prototype | +Yes | +Yes | ++ | ex | +5 | +2 | +12 | +3 | +heading,menu,menuitem,aria-busy,aria-controls,aria-disabled,aria-expanded,aria-haspopup,aria-keyshortcuts,aria-label,aria-multiselectable,aria-roledescription | +
Actions Menu Button Using aria-activedescendant | +class | ++ | + | Yes | +ex1 | +3 | +2 | +8 | +5 | +heading,aria-busy,aria-label,aria-roledescription | +
Actions Menu Button Using element.focus() | +class | ++ | + | Yes | +ex1 | +3 | +2 | +7 | +4 | +heading,aria-busy,aria-label,aria-roledescription | +
Navigation Menu Button | +class | ++ | + | Yes | +ex1 | +4 | +3 | +7 | +4 | +heading,aria-busy,aria-label,aria-roledescription | +
Editor Menubar | +class | ++ | + | Yes | +ex1 | +9 | +7 | +11 | +6 | +heading,none,aria-busy,aria-controls,aria-labelledby,aria-orientation,aria-roledescription | +
Navigation Menubar | +class | ++ | + | Yes | +ex1 | +10 | +8 | +9 | +5 | +heading,separator,aria-busy,aria-controls,aria-orientation,aria-roledescription | +
Meter | +prototype | ++ | + | + | example | +4 | +1 | +11 | +4 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-hidden,aria-label,aria-roledescription | +
Radio Group Using aria-activedescendant | +class | ++ | + | Yes | +ex1 | +5 | +2 | +9 | +3 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Rating Radio Group | +class | ++ | + | Yes | +ex1 | +6 | +3 | +8 | +3 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-roledescription | +
Radio Group Using Roving tabindex | +class | ++ | + | Yes | +ex1 | +5 | +2 | +8 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Horizontal Multi-Thumb Slider | +class | ++ | + | Yes | +ex1 | +5 | +2 | +11 | +5 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-labelledby,aria-roledescription | +
Color Viewer Slider | +class | ++ | + | Yes | +ex1 | +5 | +2 | +11 | +5 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Rating Slider | +class | ++ | + | Yes | +ex1 | +4 | +1 | +12 | +6 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Media Seek Slider | +class | ++ | + | Yes | +ex1 | +5 | +2 | +12 | +6 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Vertical Temperature Slider | +class | ++ | + | Yes | +ex1 | +5 | +2 | +13 | +7 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Date Picker Spin Button | +prototype | +Yes | ++ | + | example | +5 | +2 | +12 | +7 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-roledescription | +
Switch Using HTML Button | +class | ++ | + | Yes | +ex1 | +5 | +2 | +9 | +3 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Switch Using HTML Checkbox Input | +class | ++ | + | Yes | +ex1 | +4 | +1 | +8 | +1 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Switch | +class | ++ | + | Yes | +ex1 | +4 | +1 | +9 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Sortable Table | +class | ++ | + | Yes | +ex1 | +3 | +0 | +9 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Table | ++ | + | + | + | ex1 | +8 | +5 | +8 | +2 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-labelledby,aria-roledescription | +
Tabs with Automatic Activation | +class | ++ | + | Yes | +ex1 | +6 | +3 | +8 | +3 | +heading,menu,menuitem,aria-busy,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Tabs with Manual Activation | +class | ++ | + | Yes | +ex1 | +6 | +3 | +8 | +3 | +heading,menu,menuitem,aria-busy,aria-expanded,aria-haspopup,aria-label,aria-roledescription | +
Toolbar | ++ | + | + | + | not found | +3 | +0 | +7 | +0 | +heading,menu,menuitem,aria-busy,aria-controls,aria-expanded,aria-haspopup,aria-label,aria-labelledby,aria-roledescription | +
Toolbar | +prototype | +Yes | ++ | + | ex1 | +8 | +6 | +15 | +12 | +heading,menuitem,aria-busy,aria-labelledby,aria-roledescription | +
Treegrid Email Inbox | +prototype | +Yes | ++ | + | ex1 | +6 | +3 | +12 | +5 | +heading,menu,menuitem,aria-activedescendant,aria-busy,aria-controls,aria-current,aria-haspopup,aria-labelledby,aria-roledescription | +
File Directory Treeview Using Computed Properties | +prototype | +Yes | ++ | + | ex1 | +6 | +3 | +8 | +3 | +heading,menu,menuitem,aria-busy,aria-controls,aria-haspopup,aria-label,aria-roledescription | +
File Directory Treeview Using Declared Properties | +prototype | +Yes | ++ | + | ex1 | +6 | +3 | +11 | +6 | +heading,menu,menuitem,aria-busy,aria-controls,aria-haspopup,aria-label,aria-roledescription | +
Navigation Treeview | +class | +Yes | ++ | Yes | +ex1 | +11 | +8 | +9 | +5 | +heading,menu,menuitem,aria-busy,aria-controls,aria-haspopup,aria-roledescription | +
Example | +SVG in HTML | +SVG in CSS | +SVG in JS | +forced-color-adjust |
+ CSS ::before | +CSS ::after | +CSS content | +
---|---|---|---|---|---|---|---|
Alert Dialog | +Yes | +Yes | ++ | + | + | + | + |
Breadcrumb | ++ | + | + | + | Yes | ++ | Yes | +
Button (IDL Version) | +Yes | +Yes | ++ | + | Yes | ++ | Yes | +
Button | +Yes | +Yes | ++ | + | Yes | ++ | Yes | +
Auto-Rotating Image Carousel with Buttons for Slide Control | +Yes | +Yes | ++ | + | + | + | + |
Auto-Rotating Image Carousel with Tabs for Slide Control | +Yes | +Yes | ++ | + | + | + | + |
Checkbox (Mixed-State) | ++ | Yes | ++ | Yes | ++ | + | Yes | +
Checkbox (Two State) | ++ | Yes | ++ | Yes | ++ | + | Yes | +
Editable Combobox With Both List and Inline Autocomplete | +Yes | +Yes | ++ | + | + | + | + |
Editable Combobox With List Autocomplete | +Yes | +Yes | ++ | + | + | + | + |
Editable Combobox without Autocomplete | +Yes | +Yes | ++ | + | + | + | + |
Date Picker Combobox | +Yes | +Yes | ++ | + | + | + | Yes | +
Select-Only Combobox | ++ | + | + | + | + | Yes | +Yes | +
Date Picker Dialog | ++ | + | + | + | + | + | Yes | +
Disclosure (Show/Hide) for Answers to Frequently Asked Questions | ++ | Yes | ++ | Yes | ++ | + | Yes | +
Disclosure (Show/Hide) for Image Description | ++ | Yes | ++ | Yes | ++ | + | Yes | +
Disclosure Navigation Menu with Top-Level Links | ++ | + | + | + | + | Yes | +Yes | +
Disclosure Navigation Menu | ++ | + | + | + | + | Yes | +Yes | +
Feed Display | ++ | + | + | + | + | + | Yes | +
Advanced Data Grid | ++ | + | + | + | + | Yes | +Yes | +
Data Grid | ++ | + | + | + | + | Yes | +Yes | +
Layout Grid | ++ | + | + | + | Yes | +Yes | +Yes | +
Link | ++ | Yes | ++ | + | Yes | ++ | Yes | +
(Deprecated) Collapsible Dropdown Listbox | ++ | + | + | + | Yes | +Yes | +Yes | +
Listbox with Grouped Options | ++ | + | + | + | Yes | +Yes | +Yes | +
Listboxes with Rearrangeable Options | ++ | + | + | + | Yes | +Yes | +Yes | +
Scrollable Listbox | ++ | + | + | + | Yes | +Yes | +Yes | +
Actions Menu Button Using aria-activedescendant | +Yes | +Yes | ++ | + | + | + | + |
Actions Menu Button Using element.focus() | +Yes | +Yes | ++ | + | + | + | + |
Navigation Menu Button | +Yes | +Yes | ++ | + | + | + | + |
Editor Menubar | ++ | Yes | ++ | + | + | + | Yes | +
Navigation Menubar | +Yes | +Yes | +Yes | ++ | + | + | + |
Meter | +Yes | ++ | + | + | + | + | + |
Radio Group Using aria-activedescendant | ++ | Yes | ++ | Yes | ++ | + | Yes | +
Rating Radio Group | +Yes | +Yes | ++ | Yes | ++ | + | + |
Radio Group Using Roving tabindex | ++ | Yes | ++ | Yes | ++ | + | Yes | +
Horizontal Multi-Thumb Slider | +Yes | +Yes | +Yes | +Yes | ++ | + | + |
Color Viewer Slider | +Yes | +Yes | +Yes | +Yes | ++ | + | + |
Rating Slider | +Yes | +Yes | +Yes | +Yes | ++ | + | + |
Media Seek Slider | +Yes | +Yes | +Yes | +Yes | ++ | + | + |
Vertical Temperature Slider | +Yes | +Yes | +Yes | +Yes | ++ | + | + |
Date Picker Spin Button | +Yes | +Yes | ++ | + | + | + | + |
Switch Using HTML Button | +Yes | +Yes | +Yes | +Yes | ++ | + | + |
Sortable Table | ++ | + | + | + | + | Yes | +Yes | +
Toolbar | +Yes | +Yes | ++ | + | Yes | +Yes | +Yes | +
Treegrid Email Inbox | ++ | Yes | ++ | + | Yes | ++ | Yes | +
File Directory Treeview Using Computed Properties | ++ | + | + | + | Yes | ++ | Yes | +
File Directory Treeview Using Declared Properties | ++ | + | + | + | Yes | ++ | Yes | +
Navigation Treeview | +Yes | +Yes | ++ | + | + | + | + |
+ Learn to use the accessibility semantics defined by the Accessible Rich Internet Application (ARIA) specification to create accessible web experiences. + This guide describes how to apply accessibility semantics to common design patterns and widgets. + It provides design patterns and functional examples complemented by in-depth guidance for fundamental practices. +
+ View Patterns +Building blocks that help you make the web accessible
++ Learn how to make accessible web components and widgets with ARIA roles, states and properties and by implementing keyboard support. + One or more ways of implementing each pattern is demonstrated with a functional example. +
+ Learn More +Learn how to use HTML sectioning elements and ARIA landmark roles to make it easy for assistive technology users to understand the meaning of the layout of a page.
+ Learn More +Providing elements with accessible names and, where appropriate, accessible descriptions is one of the most important responsibilities authors have when developing accessible web experiences.
+ Learn More +Learn about other fundamental practices related to correctly using accessibility semantics, developing keyboard interfaces, and more.
+ Learn More ++ The APG Task Force relies on broad community representation and participation to continuously improve the usefulness and quality of the APG. + There are a variety of ways you can get involved and help promote development of accessible experiences. +
++ To join the APG Task Force, individuals need to first join the W3C ARIA Working Group. + Participants are expected to actively contribute to the work of the task force. +
+ Learn more about the work of the task force and how to join ++ Many valuable contributions are made by people who find or raise issues of interest in our GitHub repository and then submit proposed changes via a GitHub pull request. + If you choose this path, please start by studying our guidelines for contributing to the repository and maintaining code quality. +
+ View ReadMe in the GitHub repository ++ The APG Task Force uses the public aria-practices mailing list for email discussion. + Meeting announcements, agendas, and links to minutes are sent to the mailing list. + While GitHub issues are the preferred place to discuss APG content, the mailing list is available to anyone who would prefer to communicate with the APG Task Force via email. +
+View the aria-practices mailing list archive
++ This page includes a list of all ARIA design pattern examples indexed + either by role or by ARIA properties and states. +
+ ++ An accordion is a vertically stacked set of interactive headings that each contain a title, content snippet, or thumbnail representing a section of content. + The headings function as controls that enable users to reveal or hide their associated sections of 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:
++ 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. +
+Accordion Example: demonstrates a form divided into three sections using an accordion to show one section at a time.
+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.
+ heading
and aria-level
, such as an HTML heading tag, a native host language element may be used.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.button
element has aria-expanded set to true
. If the panel is not visible, aria-expanded is set to false
.button
element has aria-controls set to the ID of the element containing the accordion panel content.button
element has aria-disabled set to true
.region
role in circumstances that create landmark region proliferation, e.g., in an accordion that contains more than approximately 6 panels that can be expanded at the same time.region
is especially helpful to the perception of structure by screen reader users when panels contain heading elements or a nested accordion.The below example section contains a simple personal information input form divided into 3 sections that demonstrates the Accordion Pattern.
+Key | +Function | +
---|---|
Space or Enter | +When focus is on the accordion header of a collapsed section, expands the section. | +
Tab | +
+
|
+
Shift + Tab | +
+
|
+
Role | +Attribute | +Element | +Usage | +
---|---|---|---|
+ | + | h3 |
+
+
|
+
+ | aria-expanded="true" |
+ button |
+ Set to true when the Accordion panel is expanded, otherwise set to false . |
+
+ | aria-controls="ID" |
+ button |
+ Points to the ID of the panel which the header controls. | +
region |
+ + | div |
+ Creates a landmark region that contains the currently expanded accordion panel. | +
+ | aria-labelledby="IDREF" |
+ div |
+
+
|
+
+
+
+ + 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 alerts are intended to provide important and potentially time-sensitive information without interfering with the user's ability to continue working, it is crucial they do not affect keyboard focus. + The Alert Dialog Pattern is designed for situations where interrupting work flow is necessary. +
++ It is also important to avoid designing alerts that disappear automatically. + An alert that disappears too quickly can lead to failure to meet + WCAG 2.0 success criterion 2.2.3. + Another critical design consideration is the frequency of interruption caused by alerts. + Frequent interruptions inhibit usability for people with visual and cognitive disabilities, which makes meeting the requirements of + WCAG 2.0 success criterion 2.2.4 more difficult. +
+Not applicable.
+The widget has a role of alert.
+
+ The below example demonstrates the Alert Pattern.
+ Activating the Trigger Alert
button causes a message to be inserted into the example alert element.
+
Similar examples include:
+This is just a test. A typical alert is triggered by an event, such as an error, warning condition, or the arrival of information that is important in the context of the user's task.
+ ++ Because an alert is for critical information, assistive technologies may provide special behaviors designed to help call attention to changes in the text of an alert. + For example, screen readers may interrupt all other speech and preface announcement of the new alert text with a special sound or phrase. +
+No keyboard interaction needed.
+Role | +Attribute | +Element | +Usage | +
---|---|---|---|
alert |
+ + | div |
+ Identifies the element as the container where alert content will be added or updated. | +
+ |
+ aria-live=
+ |
+ Implicit on div |
+
+
|
+
+ |
+ aria-atomic=
+ |
+ Implicit on div |
+
+
|
+
+
+
+ + 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 alert dialogs special treatment, such as playing a system alert sound. +
+Alert Dialog Example: A confirmation prompt that demonstrates an alert dialog.
+See the keyboard interaction section for the modal dialog pattern.
+alertdialog
has either:
+ alertdialog
has a value set for aria-describedby that refers to the element containing the alert message.
+ - The below example of a confirmation prompt demonstrates the design pattern for an alert dialog. - It also includes an example of the design pattern for an alert to make comparing the experiences provided by the two patterns easy. -
-To use this example:
-alertdialog
role.
-
- Note: This example uses code from the modal dialog example to create the behaviors of the
+ The below example of a confirmation prompt demonstrates the Alert Dialog Pattern.
+ It also includes an example of the Alert Pattern to make comparing the experiences provided by the two patterns easy.
Similar examples include: To use this example: Similar examples include: Are you sure you want to discard all of your notes?
- This example demonstrates the
- menu button design pattern
- for a button that displays a menu of link targets.
- The menu items are made from HTML links, so they maintain their HTML link behaviors.
- That is, activating a menuitem loads the link target, and the browser's link context menu and associated actions are available.
-
- In this implementation, an HTML Similar examples include:
+ This example demonstrates the Menu Button Pattern for a button that displays a menu of link targets.
+ The menu items are made from HTML links, so they maintain their HTML link behaviors.
+ That is, activating a menuitem loads the link target, and the browser's link context menu and associated actions are available.
+
+ In this implementation, an HTML Similar examples include:
+ A menu button is a button that opens a menu as described in the Menu and Menubar Pattern.
+ It is often styled as a typical push button with a downward pointing arrow or triangle to hint that activating the button will display a menu.
+
+ The following example demonstrates using the Menubar Pattern to provide access to editing actions for a text area.
+ Each item in the menubar identifies a category of text formatting actions that can be executed from its submenu.
+ The submenus demonstrate Similar examples include: Before considering use of the Menubar Pattern for site navigation, it is important to understand:
+ The following implementation of the Menubar Pattern demonstrates how a menubar can provide navigation menus.
+ The parent menu items in the menubar represent a section of a mythical university web site and open a submenu containing menu items that link to pages within that section.
+ The navigation system it illustrates is comparable to the navigation illustrated in the
+ Example Disclosure Navigation Menu.
+ As noted above, the disclosure pattern is better suited for most web sites because few sites need the additional keyboard functionality required to support the ARIA Similar examples include:
+ A menu is a widget that offers a list of choices to the user, such as a set of actions or functions.
+ Menu widgets behave like native operating system menus, such as the menus that pull down from the menubars commonly found at the top of many desktop application windows.
+ A menu is usually opened, or made visible, by activating a menu button, choosing an item in a menu that opens a sub menu, or by invoking a command, such as Shift + F10 in Windows, that opens a context specific menu.
+ When a user activates a choice in a menu, the menu usually closes unless the choice opened a submenu.
+
+ A menu that is visually persistent is a menubar.
+ A menubar is typically horizontal and is often used to create a menu bar similar to those found near the top of the window in many desktop applications, offering the user quick access to a consistent set of commands.
+ A common convention for indicating that a menu item launches a dialog box is to append "…" (ellipsis) to the menu item label, e.g., "Save as …". The following description of keyboard behaviors assumes: When reading the following descriptions, also keep in mind that:
+ When a If aria-owns is set on the menu container to include elements that are not DOM children of the container, those elements will appear in the reading order in the sequence they are referenced and after any items that are DOM children.
+ Scripts that manage focus need to ensure the visual focus order matches this assistive technology reading order. The following example of a CPU meter demonstrates the Meter Pattern.
+ The value of this meter changes every 5 seconds.
+ Use the pause button to stop changes.
+
+ Not applicable.
+ A meter is a graphical display of a numeric value that varies within a defined range.
+ For example, a meter could be used to depict a device's current battery percentage or a car's fuel level.
+ Not applicable.
- This example implements the features of the Radio Group Design Pattern
- for two radio groups -- one for choosing a pizza crust and another for choosing a delivery method.
- This implementation uses Similar examples include:
+ This example implements the features of the Radio Group Pattern for two radio groups -- one for choosing a pizza crust and another for choosing a delivery method.
+ This implementation uses Similar examples include:
+ Following is an example of a rating input that demonstrates the Radio Group Pattern.
+ The rating is indicated by the number of stars selected by the user.
+ Similar examples include:
- This example implements the features of the Radio Group Design Pattern
- for two radio groups -- one for choosing a pizza crust and another for choosing a delivery method.
- This implementation uses a roving tabindex for managing focus within the radio group.
- Similar examples include:
+ This example implements the features of the Radio Group Pattern for two radio groups -- one for choosing a pizza crust and another for choosing a delivery method.
+ This implementation uses a roving tabindex for managing focus within the radio group.
+ Similar examples include:
+ A radio group is a set of checkable buttons, known as radio buttons, where no more than one of the buttons can be checked at a time.
+ Some implementations may initialize the set with all buttons in the unchecked state in order to force the user to check one of the buttons before moving past a certain point in the workflow.
+
+ This section describes the keyboard interaction implemented for most radio groups.
+ For the special case of a radio group nested inside a toolbar, use the keyboard interaction described in the following section.
+ The initial focus behavior 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, moving focus into the radio group with Shift+Tab will place focus on the last radio button instead of the first radio button.
+ Because arrow keys are used to navigate among elements of a toolbar and the Tab key moves focus in and out of a toolbar, when a radio group is nested inside a toolbar, the keyboard interaction of the radio group is slightly different from that of a radio group that is not inside of a toolbar.
+ For instance, users need to be able to navigate among all toolbar elements, including the radio buttons, without changing which radio button is checked.
+ So, when navigating through a radio group in a toolbar with arrow keys, the button that is checked does not change.
+ The keyboard interaction of a radio group nested in a toolbar is as follows.
+ Radio buttons in a toolbar are frequently styled in a manner that appears more like toggle buttons.
+ For an example, See the Simple Editor Toolbar Example.
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
- WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
- To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
- This is a new convention that may not be fully implemented by some assistive technologies.
- Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+ The following example of the Multi-Thumb Slider Pattern demonstrates an input for setting a pair of values that represent a range.
+ This example enables users to specify a price range for a hotel reservation by moving the two arrows (thumbs) that represent the minimum and maximum price.
- The following example of the
- multi-thumb slider design pattern
- demonstrates an input for setting a pair of values that represent a range.
- This example enables users to specify a price range for a hotel reservation by moving the two arrows (thumbs) that represent the minimum and maximum price.
- Similar examples include: Similar examples include:
+ A multi-thumb slider implements the Slider Pattern but includes two or more thumbs, often on a single rail.
+ Each thumb sets one of the values in a group of related values.
+ For example, in a product search, a two-thumb slider could be used to enable users to set the minimum and maximum price limits for the search.
+ In many two-thumb sliders, the thumbs are not allowed to pass one another, such as when the slider sets the minimum and maximum values for a range.
+ For example, in a price range selector, the maximum value of the thumb that sets the lower end of the range is limited by the current value of the thumb that sets the upper end of the range.
+ Conversely, the minimum value of the upper end thumb is limited by the current value of the lower end thumb.
+ However, in some multi-thumb sliders, each thumb sets a value that does not depend on the other thumb values.
+
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+ Horizontal Multi-Thumb Slider Example: Demonstrates a two-thumb slider for picking a price range for a hotel reservation.
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
+ Following is an example of a color viewer that demonstrates the Slider Pattern.
+ Change the background of the color view box by adjusting the sliders for red, green, and blue values.
+ The HEX and RGB values of the chosen color are displayed by the color view box.
+ Similar examples include:
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
+ Following is an example of a rating input that demonstrates the Slider Pattern.
+ This rating widget employs a slider because the slider pattern supports step values of any size.
+ This particular input enables half-star steps.
+ A typical five-star rating widget that allows only five possible values could instead be implemented as a radio group.
+ Similar examples include:
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
+ The following example of the Slider Pattern illustrates a seek control that could be used to move the current play position in an audio or video media player.
+ The example demonstrates how to use Similar examples include:
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
+ The following example is a vertically oriented temperature control that implements the Slider Pattern.
+ The slider illustrates use of Similar examples include:
+ A slider is an input where the user selects a value from within a given range.
+ Sliders typically have a slider thumb that can be moved along a bar, rail, or track to change the value of the slider.
+
+ Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
+ The following example uses the Spin Button Pattern to implement a date picker.
+ It includes three spin buttons: one for setting the day, a second for month, and a third for year.
+ Similar examples include: The spin buttons provide the following keyboard support described in the Spin Button Pattern.
+ A spinbutton is an input widget that restricts its value to a set or range of discrete values.
+ For example, in a widget that enables users to set an alarm, a spinbutton could allow users to select a number from 0 to 59 for the minute of an hour.
+
+ Spinbuttons often have three components, including a text field that displays the current value, an increase button, and a decrease button.
+ The text field is usually the only focusable component because the increase and decrease functions are keyboard accessible via arrow keys.
+ Typically, the text field also allows users to directly edit the value.
+
+ If the range is large, a spinbutton may support changing the value in both small and large steps.
+ For instance, in the alarm example, the user may be able to move by 1 minute with Up Arrow and Down Arrow and by 10 minutes with Page Up and Page Down.
+ Date Picker Spin Button Example: Illustrates a date picker made from three spin buttons for day, month, and year.
+ This example illustrates implementing the Switch Pattern with an HTML Similar examples include:
+ This example illustrates implementing the Switch Pattern with an HTML Similar examples include:
+ This example illustrates implementation of the Switch Pattern for a notification preferences control.
+ It uses a Similar examples include:
+ A switch is an input widget that allows users to choose one of two values:
+ Since switch, checkbox, and toggle button all offer binary input, they are often functionally interchangeable.
+ Choose the role that best matches both the visual design and semantics of the user interface.
+ For instance, there are some circumstances where the semantics of Important: it is critical the label on a switch does not change when its state changes.
+ The example below illustrates an implementation of the Table Pattern for a table with sortable rows.
+ The example uses HTML table markup for all elements of the table structure, e.g., cells, rows, column headers, and caption.
+ The Similar examples include:
+ Adds a diamond shaped icon (e.g. Not applicable: The only interactive elements are HTML button elements, and all their keyboard functionality is provided by browsers.
+ The below example illustrates an implementation of the WAI-ARIA Table Pattern.
+ Note that when possible, using a native HTML Similar examples include: Not Applicable
+ Like an HTML
+ However, tables are often used to present a combination of information and interactive widgets.
+ Since a table is not a widget, each widget contained in a table is a separate stop in the page tab sequence.
+ If the number of widgets is large, replacing the table with a grid can dramatically reduce the length of the page tab sequence because a grid is a composite widget that can contain other widgets.
+ As with other WAI-ARIA roles that have a native host language equivalent, authors are strongly encouraged to use a native HTML Not applicable. If rows or cells are included in a table via aria-owns, they will be presented to assistive technologies after the DOM descendants of the
- This example section demonstrates a tabs widget that implements the design pattern for tabs.
- In this example, a tab is automatically activated and its associated panel is displayed when the tab receives focus.
+
+
+ This example section demonstrates a tabs widget that implements the Tabs Pattern.
+ In this example, a tab is automatically activated and its associated panel is displayed when the tab receives focus.
It is recommended that authors consider implementing automatic activation of tabs only in circumstances where panels can be displayed instantly, i.e., all panel content is present in the DOM.
- For additional guidance, see Deciding When to Make Selection Automatically Follow Focus.
- Similar examples include: Similar examples include: Maria Theresia Ahlefeldt (16 January 1755 – 20 December 1810) was a Danish, (originally German), composer. She is known as the first female composer in Denmark. Maria Theresia composed music for several ballets, operas, and plays of the royal theatre. She was given good critic as a composer and described as a “virkelig Tonekunstnerinde” ('a True Artist of Music').
+ Maria Theresia Ahlefeldt (16 January 1755 – 20 December 1810) was a Danish, (originally German), composer.
+ She is known as the first female composer in Denmark.
+ Maria Theresia composed music for several ballets, operas, and plays of the royal theatre.
+ She was given good critic as a composer and described as a “virkelig Tonekunstnerinde” ('a True Artist of Music').
+ Carl Joachim Andersen (29 April 1847 – 7 May 1909) was a Danish flutist, conductor and composer born in Copenhagen, son of the flutist Christian Joachim Andersen. Both as a virtuoso and as composer of flute music, he is considered one of the best of his time. He was considered to be a tough leader and teacher and demanded as such a lot from his orchestras but through that style he reached a high level.
+ Carl Joachim Andersen (29 April 1847 – 7 May 1909) was a Danish flutist, conductor and composer born in Copenhagen, son of the flutist Christian Joachim Andersen.
+ Both as a virtuoso and as composer of flute music, he is considered one of the best of his time.
+ He was considered to be a tough leader and teacher and demanded as such a lot from his orchestras but through that style he reached a high level.
+ Ida Henriette da Fonseca (July 27, 1802 – July 6, 1858) was a Danish opera singer and composer. Ida Henriette da Fonseca was the daughter of Abraham da Fonseca (1776–1849) and Marie Sofie Kiærskou (1784–1863). She and her sister Emilie da Fonseca were students of Giuseppe Siboni, choir master of the Opera in Copenhagen. She was given a place at the royal Opera alongside her sister the same year she debuted in 1827.
+ Ida Henriette da Fonseca (July 27, 1802 – July 6, 1858) was a Danish opera singer and composer.
+ Ida Henriette da Fonseca was the daughter of Abraham da Fonseca (1776–1849) and Marie Sofie Kiærskou (1784–1863).
+ She and her sister Emilie da Fonseca were students of Giuseppe Siboni, choir master of the Opera in Copenhagen.
+ She was given a place at the royal Opera alongside her sister the same year she debuted in 1827.
+ Peter Erasmus Lange-Müller (1 December 1850 – 26 February 1926) was a Danish composer and pianist. His compositional style was influenced by Danish folk music and by the work of Robert Schumann; Johannes Brahms; and his Danish countrymen, including J.P.E. Hartmann.
+ Peter Erasmus Lange-Müller (1 December 1850 – 26 February 1926) was a Danish composer and pianist.
+ His compositional style was influenced by Danish folk music and by the work of Robert Schumann; Johannes Brahms; and his Danish countrymen, including J.P.E. Hartmann.
+
- The below example section demonstrates a tabs widget that implements the tabs design pattern.
- In this example, a panel is displayed when users activate its tab with either Space, Enter, or a mouse click.
+
+
+ The below example section demonstrates a tabs widget that implements the Tabs Pattern.
+ In this example, a panel is displayed when users activate its tab with either Space, Enter, or a mouse click.
So, for keyboard users, activating a tab requires two steps: 1) focus the tab, and 2) activate the tab.
This two-step process is referred to as manual activation.
Manual activation of tabs is recommended unless panels can be displayed instantly, i.e., all the panel content is present in the DOM.
- For additional guidance, see Deciding When to Make Selection Automatically Follow Focus.
- Similar examples include: Similar examples include: Maria Theresia Ahlefeldt (16 January 1755 – 20 December 1810) was a Danish, (originally German), composer. She is known as the first female composer in Denmark. Maria Theresia composed music for several ballets, operas, and plays of the royal theatre. She was given good critic as a composer and described as a “virkelig Tonekunstnerinde” ('a True Artist of Music').
+ Maria Theresia Ahlefeldt
+ (16 January 1755 – 20 December 1810) was a Danish, (originally German), composer.
+ She is known as the first female composer in Denmark.
+ Maria Theresia composed music for several ballets, operas, and plays of the royal theatre.
+ She was given good critic as a composer and described as a “virkelig Tonekunstnerinde” ('a True Artist of Music').
+ Carl Joachim Andersen (29 April 1847 – 7 May 1909) was a Danish flutist, conductor and composer born in Copenhagen, son of the flutist Christian Joachim Andersen. Both as a virtuoso and as composer of flute music, he is considered one of the best of his time. He was considered to be a tough leader and teacher and demanded as such a lot from his orchestras but through that style he reached a high level.
+ Carl Joachim Andersen
+ (29 April 1847 – 7 May 1909) was a Danish flutist, conductor and composer born in Copenhagen, son of the flutist Christian Joachim Andersen.
+ Both as a virtuoso and as composer of flute music, he is considered one of the best of his time.
+ He was considered to be a tough leader and teacher and demanded as such a lot from his orchestras but through that style he reached a high level.
+ Ida Henriette da Fonseca (July 27, 1802 – July 6, 1858) was a Danish opera singer and composer. Ida Henriette da Fonseca was the daughter of Abraham da Fonseca (1776–1849) and Marie Sofie Kiærskou (1784–1863). She and her sister Emilie da Fonseca were students of Giuseppe Siboni, choir master of the Opera in Copenhagen. She was given a place at the royal Opera alongside her sister the same year she debuted in 1827.
+ Ida Henriette da Fonseca
+ (July 27, 1802 – July 6, 1858) was a Danish opera singer and composer.
+ Ida Henriette da Fonseca was the daughter of Abraham da Fonseca (1776–1849) and Marie Sofie Kiærskou (1784–1863).
+ She and her sister Emilie da Fonseca were students of Giuseppe Siboni, choir master of the Opera in Copenhagen.
+ She was given a place at the royal Opera alongside her sister the same year she debuted in 1827.
+ Peter Erasmus Lange-Müller (1 December 1850 – 26 February 1926) was a Danish composer and pianist. His compositional style was influenced by Danish folk music and by the work of Robert Schumann; Johannes Brahms; and his Danish countrymen, including J.P.E. Hartmann.
+ Peter Erasmus Lange-Müller
+ (1 December 1850 – 26 February 1926) was a Danish composer and pianist.
+ His compositional style was influenced by Danish folk music and by the work of Robert Schumann; Johannes Brahms; and his Danish countrymen, including J.P.E. Hartmann.
+
+ 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:
+ 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".
+ For the tab list: Learn more about toolbar behaviors by reading the ARIA Authoring Practices Guide.
+ The following example of an editor toolbar implements the Toolbar Pattern and demonstrates how a toolbar can group a set of interactive widgets into a single tab stop.
+ For illustrative and interoperability assessment purposes, this implementation includes a diverse set of widgets, some of which may not be ordinarily grouped in the same toolbar.
+ For instance, it includes both a checkbox and toggle buttons.
+ In a typical implementation, the design would use either one or the other but not both.
+ Similarly, the edit field is included to help simulate actual implementation and is not intended to represent an actual rich text editor.
+ This example also illustrates the practice of
+ Managing Focus Within Components Using a Roving tabindex.
+
+ The bold, italic, underline, and text align buttons have popup labels that implement the requirements of
+ WCAG Success Criterion 1.4.13 Content on Hover or Focus:
+ The toolbar provides the following keyboard support described in the toolbar pattern.
+ The toggle buttons for choosing to apply Bold, Italic, and Underline styling provide the following keyboard support described in the
+ Button Pattern.
+
+ The buttons for choosing left, center, or right text alignment are styled like toggle buttons.
+ However, since pressing one toggles off another so that only one button in the group is in the pressed state, the toggles behave like radio buttons.
+ Because ARIA is designed to inform assistive technologies about UI semantics and behaviors, not styling, the alignment toggles provide the following keyboard support described in the
+ Radio Group Pattern.
+ As described in the pattern, nesting a radio group in a toolbar calls for an important behavioral difference compared to radios outside a toolbar: moving focus inside the group does not automatically change which button is checked.
+ In addition, because Left Arrow and Right Arrow are needed by the parent toolbar, they are not captured by the radio group.
+ The toolbar thus provides navigation into, inside, and out of the nested radio group.
+
+ The buttons for cut, copy, and paste provide the following keyboard support described in the
+ Button Pattern.
+ While they are HTML button elements, as described in the accessibility features section above, in order to remain focusable when disabled, they have
+ The menu button for opening the font family menu provides the following keyboard support described in the
+ Menu Button Pattern.
+
+ The menu for choosing a font family provides the following keyboard support described in the
+ Menu and Menubar Pattern.
+
+ The spin button for changing font size provides the following keyboard support described in the
+ Spin Button Pattern.
+
+ The checkbox for toggling night mode provides the following keyboard support defined in the
+ Checkbox Pattern.
+ As an HTML input element, the browser provides the keyboard support.
+
+ The link for opening a help page provides the following keyboard support described in the Link Pattern.
+ As an HTML link, the keyboard support is provided by the browser.
+ The toolbar implements the following ARIA attributes described in the Toolbar Pattern.
+ The toggle buttons for choosing to apply Bold, Italic, and Underline styling implement the following ARIA attributes described in the
+ Button Pattern.
+
+ The buttons for choosing left, center, or right text alignment are styled like toggle buttons.
+ However, since pressing one toggles off another so that only one button in the group is in the pressed state, the toggles behave like radio buttons.
+ Because ARIA is designed to inform assistive technologies about UI semantics and behavior, not styling, the alignment toggles implement the following ARIA attributes described in the
+ Radio Group Pattern.
+
+ The buttons for cut, copy, and paste implement the following ARIA attributes described in the
+ Button Pattern.
+ While they are HTML button elements, as described in the accessibility features section above, in order to remain focusable when disabled, they have
+ The menu button for opening the font family menu implements the following ARIA attributes described in the
+ Menu Button Pattern.
+
+ The menu for choosing a font family implements the following ARIA attributes described in the
+ Menu and Menubar Pattern.
+
+ The spin button for changing font size implements the following ARIA attributes described in the
+ Spin Button Pattern.
+ 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 To optimize the benefit of toolbar widgets: Toolbar Example: A toolbar that uses roving tabindex to manage focus and contains several types of controls, including toggle buttons, radio buttons, a menu button, a spin button, a checkbox, and a link.
+ NOTE: This design pattern is work in progress; it does not yet have task force consensus.
+ Progress and discussions are captured in issue 128.
+
+ A tooltip is a popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
+ It typically appears after a small delay and disappears when Escape is pressed or on mouse out.
+
+ Tooltip widgets do not receive focus.
+ A hover that contains focusable elements can be made using a non-modal dialog.
+ Work to develop a tooltip example is tracked by issue 127. Escape: Dismisses the Tooltip. The following example demonstrates how the Treegrid Pattern can be used to make an interactive tree that enables users to both navigate the hierarchical structure of email conversations and also navigate elements that describe each email, such as subject and sender. Similar examples include:
+ This example demonstrates three different ways of implementing the keyboard navigation specified in the treegrid pattern.
+ The following links change the behavior of the navigation keys:
+
+ Note: A row-only option is not provided.
+ A treegrid where cells cannot be focused would be implemented as a tree view.
+ A treeview that has columns in its visual presentation may be appropriate when all the following conditions are present:
+ NOTE: The following table includes descriptions of how keyboard commands move focus among cells and rows in the treegrid implementation on this page.
+ In the example on this page, some cells contain a single focusable widget, and if a cell contains a widget, the cell is not focusable; the widget receives focus instead of the cell.
+ So, when a keyboard command description says a command moves focus to a cell, the command may either focus the cell or a widget inside the cell.
+
+ NOTE: Due to an error in the ARIA 1.1 specification, the
+ A treegrid widget presents a hierarchical data grid consisting of tabular information that is editable or interactive.
+ Any row in the hierarchy may have child rows, and rows with children may be expanded or collapsed to show or hide the children.
+ For example, in a
+ In a treegrid both rows and cells are focusable.
+ Every row and cell contains a focusable element or is itself focusable, regardless of whether individual cell content is editable or interactive.
+ There is one exception: if column header cells do not provide functions, such as sort or filter, they do not need to be focusable.
+ One reason it is important for all cells to be able to receive or contain keyboard focus is that screen readers will typically be in their application reading mode, rather than their document reading mode, when users are interacting with the grid.
+ While in application mode, a screen reader user hears only focusable elements and content that labels focusable elements.
+ So, screen reader users may unknowingly overlook elements contained in a
+ When using a keyboard to navigate a E-mail Inbox
+ The following keys provide If a treegrid supports selection of cells, rows, or columns, the following keys are commonly used for these functions. See Key Assignment Conventions for Common Functions for cut, copy, and paste key assignments.
- The following example implementation of the
- Tree View Design Pattern
- simulates a widget for selecting a file or folder from within a hierarchical file system for viewing in a file viewer.
- In the
- This example relies on the browser to compute values for Similar examples include:
+ The following example implementation of the Tree View Pattern simulates a widget for selecting a file or folder from within a hierarchical file system for viewing in a file viewer.
+ In the
+ This example relies on the browser to compute values for Similar examples include:
+
+
- To make the focus indicator easier to see, nodes in the tree have custom focus and hover styling created using CSS focus and hover pseudo-classes.
- To make the focus indicator easier to see, nodes in the tree have custom focus and hover styling created using CSS focus and hover pseudo-classes.
Note that in this example, selection and focus are distinct; moving focus does not change which node is selected.
Because selection does not follow focus, keyboard and screen reader users can navigate and explore the tree without changing the content of the file viewer.
- To learn more about this aspect of the design, read the guidance section about Deciding When to Make Selection Automatically Follow Focus.
+ To learn more about this aspect of the design, see
+ Deciding When to Make Selection Automatically Follow Focus.
+ The following example implementation of the Tree View Pattern simulates a widget for selecting a file or folder from within a hierarchical file system for viewing in a file viewer.
+ In the
+ The code in this example explicitly declares values for Similar examples include:
+
+ To make the focus indicator easier to see, nodes in the tree have custom focus and hover styling created using CSS focus and hover pseudo-classes.
+ A tree item that can be expanded to reveal child items is called a parent node.
+ It is a closed node when the children are hidden and an open node when it is expanded.
+ An end node does not have any children.
+ For a complete list of terms and definitions, see the Tree View Pattern.
+
+ Note that in this example, selection and focus are distinct; moving focus does not change which node is selected.
+ Because selection does not follow focus, keyboard and screen reader users can navigate and explore the tree without changing the content of the file viewer.
+ To learn more about this aspect of the design, read the guidance section about
+ Deciding When to Make Selection Automatically Follow Focus.
+
+ A tree view widget presents a hierarchical list.
+ Any item in the hierarchy may have child items, and items that have children may be expanded or collapsed to show or hide the children.
+ For example, in a file system navigator that uses a tree view to display folders and files, an item representing a folder can be expanded to reveal the contents of the folder, which may be files, folders, or both.
+
+ When using a keyboard to navigate a tree, a visual keyboard indicator informs the user which item is focused.
+ If the tree allows the user to choose just one item for an action, then it is known as a single-select tree.
+ In some implementations of single-select tree, the focused item also has a selected state; this is known as selection follows focus.
+ However, in multi-select trees, which enable the user to select more than one item for an action, the selected state is always independent of the focus.
+ For example, in a typical file system navigator, the user can move focus to select any number of files for an action, such as copy or move.
+ It is important that the visual design distinguish between items that are selected and the item that has focus.
+ For more details, see this description of differences between focus and selection
+ and Deciding When to Make Selection Automatically Follow Focus.
+ Terms for describing tree views include: For a vertically oriented tree:
+ NOTE: ARIA 1.1 introduced changes to the separator role so it behaves as a widget when focusable.
+ While this pattern has been revised to match the ARIA 1.1 specification, the task force will not complete its review until a functional example that matches the ARIA 1.1 specification is complete.
+ Progress on this pattern is tracked by issue 129.
+
+ A window splitter is a moveable separator between two sections, or panes, of a window that enables users to change the relative size of the panes.
+ A Window Splitter can be either variable or fixed.
+ A fixed splitter toggles between two positions whereas a variable splitter can be adjusted to any position within an allowed range.
+
+ A window splitter has a value that represents the size of one of the panes, which, in this pattern, is called the primary pane.
+ When the splitter has its minimum value, the primary pane has its smallest size and the secondary pane has its largest size.
+ The splitter also has an accessible name that matches the name of the primary pane.
+
+ For example, consider a book reading application with a primary pane for the table of contents and a secondary pane that displays content from a section of the book.
+ The two panes are divided by a vertical splitter labelled "Table of Contents".
+ When the table of contents pane has its maximum size, the splitter has a value of Note that the term "primary pane" does not describe the importance or purpose of content inside the pane. Work to develop an example window splitter widget is tracked by issue 130. A fixed size splitter omits implementation of the arrow keys.
+ To fully present and describe a grid or table, in addition to parsing the headers, rows, and cells using the roles described in the grid pattern or table pattern, assistive technologies need to be able to determine other structural and presentation characteristics, such as the number and visibility of rows and columns.
+ Characteristics that may need to be described with additional WAI-ARIA attributes include:
+
+ Browsers automatically populate their accessibility tree with the number of rows and columns in a grid or table based on the rendered DOM.
+ However, there are many situations where the DOM does not contain the whole grid or table, such as when the data set is too large to fully render.
+ Additionally, some of this information, like skipped columns or rows and how data is sorted, cannot be derived from the DOM structure.
+ The below sections explain how to use the following properties that ARIA provides for grid and table accessibility. When the number of rows represented by the DOM structure is not the total number of rows available for a table, grid, or treegrid, the
+ The
+ When
+ WARNING! Missing or inconsistent values of The following code demonstrates the use of When the number of columns represented by the DOM structure is not the total number of columns available for a table, grid, or treegrid, the
+ The
+ When
+ WARNING! Missing or inconsistent values of
+ When all the cells in a row have column index numbers that are consecutive integers,
+ The following code shows a grid with 16 columns, of which columns 2 through 5 are displayed to the user.
+ Because the set of columns is contiguous,
+ When the cells in a row have column index numbers that are not consecutive integers, For tables, grids, and treegrids created using elements other than HTML The value of The value of
+ The following example grid has a two row header.
+ The first two columns have headers that span both rows of the header.
+ The subsequent 6 columns are grouped into 3 pairs with headers in the first row that each span two columns.
+ Note: When using HTML
+ When rows or columns are sorted, the
+ It is important to note that ARIA does not provide a way to indicate levels of sort for data sets that have multiple sort keys.
+ Thus, there is limited value to applying The following example grid uses
+ While ARIA is primarily used to express semantics, there are some situations where hiding an element’s semantics from assistive technologies is helpful.
+ This is done with the presentation role, which declares that an element is being used only for presentation and therefore does not have any accessibility semantics.
+ The ARIA 1.1 specification also includes role none, which serves as a synonym for For example, consider a tabs widget built using an HTML
+ Because the list is declared to be a tablist, the list items are not in a list context.
+ It could confuse users if an assistive technology were to render those list items.
+ Applying role Three common uses of role
+ When Browsers ignore In the following code, role When the above code is parsed by a browser, it is semantically equivalent to the following code:
+ There are some types of user interface components that, when represented in a platform accessibility API, can only contain text.
+ For example, accessibility APIs do not have a way of representing semantic elements contained in a button.
+ To deal with this limitation, WAI-ARIA requires browsers to automatically apply role The roles that require all children to be presentational are: For instance, consider the following tab element, which contains a heading.
+ Because WAI-ARIA requires descendants of tab to be presentational, the heading semantic is not exposed to assistive technology users.
+ Thus, the following code is equivalent.
+
+ So, from the perspective of anyone using a technology that relies on an accessibility API, such as a screen reader, the heading does not exist.
+ As described above in the section on Effects of Role
+ 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.
+ This section covers: Work to complete this section is tracked by issue 217.
+ 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.
+
+ 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 With respect to focus and the selected state, the most important considerations for designers and developers are:
+ In composite widgets where only one element may be selected, such as a tablist or single-select listbox, moving the focus may also cause the focused element to become the selected element.
+ This is called having selection follow focus.
+ Having selection follow focus is often beneficial to users, but in some circumstances, it is extremely detrimental to accessibility.
+
+ For example, in a tablist, the selected state is used to indicate which panel is displayed.
+ So, when selection follows focus in a tablist, moving focus from one tab to another automatically changes which panel is displayed.
+ If the content of panels is present in the DOM, then displaying a new panel is nearly instantaneous.
+ A keyboard user who wishes to display the fourth of six tabs can do so with 3 quick presses of the right arrow.
+ And, a screen reader user who perceives the labels on tabs by navigating through them may efficiently read through the complete list without any latency.
+
+ However, if displaying a new panel causes a network request and possibly a page refresh, the effect of having selection automatically focus can be devastating to the experience for keyboard and screen reader users.
+ In this case, displaying the fourth tab or reading through the list becomes a tedious and time-consuming task as the user experiences significant latency with each movement of focus.
+ Further, if displaying a new tab refreshes the page, then the user not only has to wait for the new page to load but also return focus to the tab list.
+ When selection does not follow focus, the user changes which element is selected by pressing the Enter or Space key.
+ As explained in section Fundamental Keyboard Navigation Conventions, all interactive UI components need to be reachable via 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 SVG2 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 macOS, where it includes only form elements.
+ macOS 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 Discernible and Predictable Keyboard Focus.
+ 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.
+ As described in section Fundamental Keyboard Navigation Conventions, 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 APG Patterns.
+
+ The convention for where focus lands in a composite when it receives 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.
+ 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.
+ 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.
+ 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.
+ 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.
+
+ 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
+ menu and menubar 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.
+ 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.
+ The following key assignments can be used in any context where their conventionally associated functions are appropriate.
+ While the assignments associated with Windows and Linux platforms can be implemented and used in browsers running in macOS, replacing them with macOS assignments in browsers running on a macOS device can make the keyboard interface more discoverable and intuitive for those users.
+ In some cases, it may also help avoid system or browser keyboard conflicts.
+
+ 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:
+ This section explains the following factors when determining which elements and features to assign keyboard shortcuts and what behavior to give each shortcut:
+ 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:
+ The following conventions may help identify the most advantageous behavior for a keyboard shortcut. Work to draft content for this section is tracked in issue 219.
+ The first goal when designing a keyboard interface is simple, efficient, 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: When choosing the keys to assign to a shortcut, there are many factors to consider.
+ 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.
+ It is essential to avoid conflicts with keys that perform system level functions, such as application and window management and display and sound control.
+ In general, this can be achieved by refraining from the following types of assignments.
+
+ In addition, there are some important application level features that most applications, including browsers, generally support.
+ These include:
+
+ 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.
+ While there is considerable similarity among browser keyboard schemes, the patterns within the schemes are less homogenous.
+ 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:
+
+ 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:
+
+ For example, consider a save function that is available when the focus is in an editor.
+ Most browsers use ... to be continued ...
+
+ ARIA landmark roles provide a powerful way to identify the organization and structure of a web page.
+ By classifying and labelling sections of a page, they enable structural information that is conveyed visually through layout to be represented programmatically.
+ Screen readers exploit landmark roles to provide keyboard navigation to important sections of a page.
+ Landmark regions can also be used as targets for "skip links" and by browser extensions to enhanced keyboard navigation.
+ This section explains how HTML sectioning elements and ARIA landmark roles are used to make it easy for assistive technology users to understand the meaning of the layout of a page.
+ Several HTML sectioning elements automatically create ARIA landmark regions.
+ So, in order to provide assistive technology users with a logical view of a page, it is important to understand the effects of using HTML sectioning elements.
+ [[HTML-ARIA]] contains more information on HTML element role mapping.
+ Including all perceivable content on a page in one of its landmark regions and giving each landmark region a semantically meaningful role is one of the most effective ways of ensuring assistive technology users will not overlook information that is relevant to their needs. Step 1: Identify the logical structure Step 2: Assign landmark roles to each area Step 3: Label areas
+ A Use the HTML If the HTML A If the HTML A The HTML Use the A Use the HTML If the HTML A The HTML If the HTML A There is no HTML element that defines a The
+ Providing elements with accessible names, and where appropriate, accessible descriptions, is one of the most important responsibilities authors have when developing accessible web experiences.
+ While doing so is straightforward for most elements, technical mistakes that can completely block users of assistive technologies are easy to make and unfortunately common.
+ To help authors effectively provide accessible names and descriptions, this section explains their purpose, when authors need to provide them, how browsers assemble them, and rules for coding and composing them.
+ It also guides authors in the use of the following naming and describing techniques and WAI-ARIA properties:
+
+ An accessible name is a short string, typically 1 to 3 words, that authors associate with an element to provide users of assistive technologies with a label for the element.
+ For example, an input field might have an accessible name of "User ID" or a button might be named "Submit".
+ An accessible name serves two primary purposes for users of assistive technologies, such as screen readers:
+ Both the WAI-ARIA specification and WCAG require all focusable, interactive elements to have an accessible name.
+ In addition dialogs and some structural containers, such as tables and regions, are required to have a name.
+ Many other elements can be named, but whether a name will enhance the accessible experience is determined by various characteristics of the surrounding context.
+ Finally, there are some elements where providing an accessible name is technically possible but not advisable.
+ The Accessible Name Guidance by Role section lists naming requirements and guidelines for every ARIA role.
+
+ An accessible description is also an author-provided string that is rendered by assistive technologies.
+ Authors supply a description when there is a need to associate additional information with an element, such as instructions or format requirements for an input field.
+
+ Assistive technologies present names differently from descriptions.
+ For instance, screen readers typically announce the name and role of an element first, e.g., a button named
+ Because there are several elements and attributes for specifying text to include in an accessible name or description string, and because authors can combine them in a practically endless number of ways, browsers implement fairly complex algorithms for assembling the strings.
+ The sections on accessible name calculation and accessible description calculation explain the algorithms and how they implement precedence.
+ However, most authors do not need such detailed understanding of the algorithms since nearly all circumstances where a name or description is useful are supported by the coding patterns described in the naming techniques and describing techniques sections.
+
+ Several of the naming techniques below include notes that warn against specific coding patterns that are either prohibited by the ARIA specification or fall into gray space that is not yet fully specified.
+ Some of these prohibited or ambiguous patterns may appear logical and even yield desired names in some browsers.
+ However, it is unlikely they will provide consistent results across browsers, especially over time as work to improve the consistency of name calculation across browsers progresses.
+ In addition to heeding the warnings provided in the naming techniques, it is difficult to over emphasize the importance of testing to ensure that names browsers calculate match expectations.
+ When a user interface includes visible text that could be used to provide an appropriate accessible name, using the visible text for the accessible name simplifies maintenance, prevents bugs, and reduces language translation requirements.
+ When names are generated from text that exists only in markup and is never displayed visually, there is a greater likelihood that accessible names will not be updated when the user interface design or content are changed.
+
+ If an interactive element, such as an input field or button, does not have a visually persistent text label, consider adjusting the design to include one.
+ In addition to serving as a more robust source for an accessible name, visible text labels enhance accessibility for many people with disabilities who do not use assistive technologies that present invisible accessible names.
+ In most circumstances, visible text labels also make the user interface easier to understand for all users.
+
+ In HTML documents, whenever possible, rely on HTML naming techniques, such as the HTML
+ When authors do not specify an accessible name using an element or attribute that is intended for naming, browsers attempt to help assistive technology users by resorting to fallback methods for generating a name.
+ For example, the HTML
+ Similar to how visually crowded screens and ambiguous icons reduce usability, excessively long, insufficiently distinct, or unclear accessible names can make a user interface very difficult, or even impossible, to use for someone who relies on a non-visual form of the user interface.
+ In other words, for a web experience to be accessible, its accessible names must be effective.
+ The section on Composing Effective and User-friendly Accessible Names provides guidance for balancing brevity and clarity.
+
+ Certain elements get their name from the content they contain.
+ For example, the following link is named "Home".
+
+ When assistive technologies render an element that gets its accessible name from its content, such as a link or button, the accessible name is the only content the user can perceive for that element.
+ This is in contrast to other elements, such as text fields or tables, where the accessible name is a label that is presented in addition to the value or content of the element.
+ For instance, the accessible name of a table can be derived from a caption element, and assistive technologies render both the caption and all other content contained inside the table.
+ Elements having one of the following roles are, by default, named by a string calculated from their descendant content:
+ When calculating a name from content for an element, user agents recursively walk through each of its descendant elements, calculate a name string for each descendant, and concatenate the resulting strings.
+ In two special cases, certain descendants are ignored: If an element with one of the above roles that supports naming from child content is named by using
+ The aria-label property enables authors to name an element with a string that is not visually rendered.
+ For example, the name of the following button is "Close".
+ The
+ The When encountering this navigation region, a screen reader user will hear the name and role of the element, e.g., "Product navigation region", and then be able to read through the links contained in the region.
+ The aria-labelledby property enables authors to reference other elements on the page to define an accessible name.
+ For example, the following switch is named by the text content of a previous sibling element.
+
+ Note that while using The An example of referencing a hidden element with
+ In some cases, the most effective name for an element is its own content combined with the content of another element.
+ Because
+ When multiple elements are referenced by In the above example, the accessible name of the button will be "Download PDF, 2.4 MB", with a space between "Download" and "PDF", and not "DownloadPDF, 2.4 MB".
+ The HTML
+ For example, text displayed adjacent to a checkbox may be visually associated with the checkbox, so it is understood as the checkbox label by users who can perceive that visual association.
+ However, unless the text is programmatically associated with the checkbox, assistive technology users will experience a checkbox without a label.
+ Wrapping the checkbox and the labeling text in a
+ A form control can also be associated with a label by using the
+ Using the
+ The HTML
+ This grouping technique is particularly useful for presenting multiple choice questions.
+ It enables authors to associate a question with a group of answers.
+ If a question is not programmatically associated with its answer options, assistive technology users may access the answers without being aware of the question.
+ Similar benefits can be gained from grouping and naming other types of related form fields using Using the
+ The accessible name for HTML
+ In HTML, the The following example gives the table a number ( Note: Above table content is from Caloric restriction, the traditional Okinawan diet, and healthy aging: the diet of the world's longest-lived people and its potential impact on morbidity and life span.
+ If a
+ Similarly, an HTML
+ Like with Using the
+ When an accessible name is not provided using one of the primary techniques (e.g., the
+ Any HTML element can have a For example, a
+ For the HTML
+ For assistive technology users, especially screen reader users, the quality of accessible names is one of the most significant contributors to usability.
+ Names that do not provide enough information reduce users' effectiveness while names that are too long reduce efficiency.
+ And, names that are difficult to understand reduce effectiveness, efficiency, and enjoyment.
+ The following guidelines provide a starting point for crafting user friendly names.
+ Certain elements always require a name, others may usually or sometimes require a name, and still others should never be named.
+ The table below lists all ARIA roles and provides the following information for each:
+
+ User agents construct an accessible name string for an element by walking through a list of potential naming methods and using the first that generates a name.
+ The algorithm they follow is defined in the accessible name specification.
+ It is roughly like the following:
+ The If the name is still empty, the
+ If the name is still empty, then host-language-specific attributes or elements are used if present.
+ For HTML, these are, depending on the element:
+ If the name is still empty, then for elements with a role that supports naming from child content, the content of the element is used.
+ Finally, if the name is still empty, then other fallback host-language-specific attributes or elements are used if present.
+ For HTML, these are, depending on the element:
+
+ The final step is a fallback mechanism.
+ Generally when labeling an element, use one of the non-fallback mechanisms.
+
+ When calculating a name from content, the user agent walks through all descendant nodes except in the cases of
+ When calculating a name from content for the
+ Similarly, when calculating a name from content for the Consider an If there is a If there is also a If there is also a If there is also an If there is also an
+ The accessible name calculation algorithm will be invoked recursively when necessary.
+ An In this example, the label for the button is computed by recursing into each child node, resulting in When following an
+ In this example, the label for the button is computed by first following the
+ The
+ Descriptions are reduced to text strings.
+ For example, if the description contains an HTML
+ As with
+ In HTML, if the
+ The HTML If an accessible description was not provided using the
+ A visible description together with Note that the For example, an The As another example, a link can use the Like the accessible name calculation, the accessible description calculation produces a text string.
+ The accessible description calculation algorithm is the same as the accessible name calculation algorithm except for a few branch points that depend on whether a name or description is being calculated.
+ In particular, when accumulating text for an accessible description, the algorithm uses
+ User agents construct an accessible description string for an element by walking through a list of potential description methods and using the first that generates a description.
+ The algorithm they follow is defined in the accessible name specification.
+ It is roughly like the following:
+ The
+ If the description is still empty, then host-language-specific attributes or elements are used if present, if it wasn't already used as the accessible name.
+ For HTML, these are, depending on the element:
+
+ Finally, if the description is still empty, then other host-language-specific attributes or elements are used if present, if it wasn't already used for the accessible name.
+ For HTML, this is the ARIA defines the following roles as range widgets, which means they communicate a value that is typically numeric and constrained to defined limits.
+ For example, a spin button for choosing a day within the month of January would allow integer values that range from 1 to 31.
+ In some cases, the value is represented numerically, but is not presented as a number to users.
+ For instance, a spin button for choosing a day of the week could support values from 1 to 7 but they could be presented to the user as day names, e.g., "Monday", "Tuesday", etc.
+ This section describes considerations for using the following four properties that communicate characteristics of a range widget:
+ Functionally, ARIA roles, states, and properties are analogous to a CSS for assistive technologies.
+ For screen reader users, ARIA controls the rendering of their non-visual experience.
+ Incorrect ARIA misrepresents visual experiences, with potentially devastating effects on their corresponding non-visual experiences.
+ Before using ARIA or any of the guidance in this document, please take time to understand the following two essential principles. This code:
+ Is a promise that the author of that Using a role without fulfilling the promise of that role is similar to making a "Place Order" button that abandons an order and empties the shopping cart. One of the objectives of this guide is to define expected behaviors for each ARIA role.
+ The information assistive technologies need about the meaning and purpose of user interface elements is called accessibility semantics.
+ From the perspective of assistive technologies, ARIA gives authors the ability to dress up HTML and SVG elements with critical accessibility semantics that the assistive technologies would not otherwise be able to reliably derive.
+ Some of ARIA is like a cloak; it covers up, or overrides, the original semantics or content. On the other hand, some uses of ARIA are more like suspenders or belts; they add meaning that provides essential support to the original content.
+ This is the power of ARIA.
+ It enables authors to describe nearly any user interface component in ways that assistive technologies can reliably interpret, thus making components accessible to assistive technology users.
+
+ This is also the danger of ARIA.
+ Authors can inadvertently override accessibility semantics.
+
+ Testing assistive technology interoperability is essential before using code from this guide in production.
+ Because the purpose of this guide is to illustrate appropriate use of ARIA 1.2 as defined in the ARIA specification, the design patterns, reference examples, and sample code intentionally do not describe and implement coding techniques for working around problems caused by gaps in support for ARIA 1.2 in browsers and assistive technologies.
+ It is thus advisable to test implementations thoroughly with each browser and assistive technology combination that is relevant within a target audience.
+
+ Similarly, JavaScript and CSS in this guide is written to be compatible with the most recent version of Chrome, Firefox, and Safari at the time of writing.
+ Some JavaScript and CSS may not function correctly in Internet Explorer.
+
+ Except in cases where the ARIA Working Group and other contributors have overlooked an error,
+ examples in this guide that do not function well in a particular browser or with a specific assistive technology are demonstrating browser or assistive technology bugs.
+ Browser and assistive technology developers can thus utilize code in this guide to help assess the quality of their support for ARIA 1.2.
+
+ Currently, this guide does not indicate which examples are compatible with mobile browsers or touch interfaces.
+ While some of the examples include specific features that enhance mobile and touch support, some ARIA features are not supported in any mobile browser.
+ In addition, there is not yet a standardized approach for providing touch interactions that work across mobile browsers.
+ More guidance about touch and mobile support is planned for future releases of the guide.
+ ARIA provides a set of roles that convey the accessibility semantics of structures on a page.
+ These roles express the meaning that is conveyed by the layout and appearance of elements that organize and structure content, such as headings, lists, and tables.
+
+ Some host languages, such as HTML, include elements that express the same semantics as an ARIA role.
+ For instance, the HTML
+ When developing HTML, it is important to use native HTML elements where ever possible.
+ Do not use an ARIA role or property if it is possible to use an HTML element that has equivalent semantics.
+ Circumstances where it is appropriate to use ARIA attributes instead of equivalent HTML are:
+ The following table lists all structural roles defined in ARIA 1.2.
+ As described above in the section on When to Use Structural Roles, use an equivalent HTML element instead of an ARIA structural role unless the ARIA role does not have an HTML equivalent or one of the four circumstances that makes using ARIA necessary exists.
+
+ The code in this example is not intended for production environments.
+ Before using it for any purpose, read this to understand why.
+ This is an illustrative example of one way of using ARIA that conforms with the ARIA specification.
- This page includes information on number of guidance and example references in the WAI-ARIA Authoring Practices for each ARIA role, property and state. The guidance column is determined
- by either the role, property or state being in the text content of a heading (e.g.
- The below example section contains a simple personal information input form divided into 3 sections
- that demonstrates the
- design pattern for accordion.
-
- The below example demonstrates the design pattern for alert.
- Activating the Similar examples include:
- This is just a test.
- A typical alert is triggered by an event, such as an error, warning condition, or the arrival of information that is important in the context of the user's task.
-
- Because an alert is for critical information, assistive technologies may provide special behaviors designed to help call attention to changes in the text of an alert.
- For example, screen readers may interrupt all other speech and preface announcement of the new alert text with a special sound or phrase.
- No keyboard interaction needed. The following example demonstrates the breadcrumb design pattern. No keyboard interaction needed.
- The following command and toggle button examples demonstrate the button design pattern.
- Similar examples include: This This
- The following examples of the button design pattern demonstrate a new JavaScript syntax for coding ARIA attributes.
-
- The JavaScript for the example buttons on this page uses the IDL Interface defined in ARIA 1.2.
- The purpose of these examples is to illustrate how to use ARIA Attribute Reflection and provide a test case for browser and assistive technology interoperability.
- Specifically, the
- IMPORTANT: This example is coded using syntax that was not introduced until version 1.2 of the ARIA specification.
- When using a browser that does not yet provide support for ARIA attribute reflection, the buttons will not be styled correctly.
- This This
- The following example implementation of the
- carousel design pattern
- demonstrates features of the pattern that are essential to accessibility for carousels that automatically start rotating when the page loads.
- For instance, rotation stops when users either move focus into the carousel or hover the mouse over carousel content, and users can manually control which slide is displayed with previous and next slide buttons.
- The accessibility features section that follows the example describes these features in detail.
- Similar examples include: Sept. 14 to Sept. 24 or 27 8 pm Sunday, March 8, on TV: Sneak peek at the final season.
- Users can stop and start slide rotation, which is an essential aspect of accessibility of the carousel for a variety of people with disabilities.
- People with low vision or a cognitive disability that affects visual processing or reading benefit from being able to control slide rotation so they have sufficient time to explore slide content.
- Similarly, since screen reader users cannot perceive automatic rotation, it can make reading the page confusing and disorienting.
- For example, when slides are automatically rotating, a screen reader user may read an element on slide one, execute a screen reader command to read the next element, and, instead of hearing the next element on slide one, hear an element from slide 2 without any knowledge that the element just announced is from an entirely new context.
- This example includes the following features for giving users control over slide rotation:
- In the view of this carousel where the controls and captions are displayed inside the image, background images could cause color contrast for the controls and text to become insufficient.
- However, this view includes the following features to prevent this potential problem and ensure it meets WCAG 2.1 color contrast requirements:
- One way to avoid the color contrast issues caused by displaying controls and text within the images is to position the controls outside the image. Displaying the controls and text on a solid background makes it easier to control color contrast. One of the view options provides an example of this technique.
- When automatic rotation is turned off, the carousel slide content is included in a live region.
- This makes it easier for screen reader users to scan through the carousel slides.
- When screen reader users activate the next or previous slide button, the new slide content is announced, giving users immediate feedback that helps them determine whether or not to interact with the content.
- Very importantly, if automatic rotation is turned on, the live region is disabled.
- If it were not, the page would become unusable as announcements of the continuously changing content constantly interrupt anything else the user is reading.
-
- This example demonstrates using the Checkbox Design Pattern to create a tri-state, or mixed-state, checkbox.
- In this implementation, the mixed-state checkbox represents the state of a set of standard HTML checkboxes.
- If none of the checkboxes in the set are checked, the mixed state checkbox is not checked, and if all members of the set are checked, the mixed state checkbox is checked.
- If the set contains both some checked and unchecked checkboxes, the mixed state checkbox is partially checked.
- Activating the tri-state checkbox changes the states of the checkboxes in the set.
- Similar examples include: This example implements the Checkbox Design Pattern for a two state checkbox using Similar examples include:
-
- Replace this paragraph with an overview of the example that is something like the following. The
- below example section demonstrates a simple checkbox that implements the
- design pattern for checkbox.
- This example uses ... summarize salient techniques )
- Similar examples include: This is the place where the reader will experience the functioning example. Optional section: If appropriate, please replace this content with a list of any special or noteworthy accessibility features
- demonstrated in this implementation, such as:
- The below combobox for choosing the name of a US state or territory demonstrates the
- design pattern for combobox.
- The design pattern describes four types of autocomplete behavior.
- This example illustrates the autocomplete behavior referred to in the pattern as list with inline completion.
- If the user types one or more characters in the edit box and the typed characters match the beginning of the name of one or more states or territories,
- a listbox popup appears containing the matching names, and the first match is automatically selected.
- In addition, the portion of the selected suggestion that has not been typed by the user, a completion string, appears inline after the input cursor in the textbox.
- The automatically selected suggestion becomes the value of the textbox when the combobox loses focus unless the user chooses a different suggestion or changes the character string in the textbox.
- Note that this implementation enables users to input the name of a state or territory, but it does not prevent input of any other arbitrary value.
- Similar examples include:
- The example combobox on this page implements the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the combobox design pattern.
-
- NOTE: When visual focus is in the listbox, DOM focus remains on the textbox and the value of
- The button has been removed from the tab sequence of the page, but is still important to assistive technologies for mobile devices that use touch events to open the list of options.
-
- The example combobox on this page implements the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the combobox design pattern.
-
- The below combobox for choosing the name of a US state or territory demonstrates the
- ARIA design pattern for combobox.
- The design pattern describes four types of autocomplete behavior.
- This example illustrates the autocomplete behavior known as list autocomplete with manual selection.
- If the user types one or more characters in the edit box and the typed characters match the beginning of the name of one or more states or territories, a listbox popup appears containing the matching names.
- When the listbox appears, a suggested name is not automatically selected.
- Thus, after typing, if the user tabs or clicks out of the combobox without choosing a value from the listbox, the typed string becomes the value of the combobox.
- Note that this implementation enables users to input the name of a state or territory, but it does not prevent input of any other arbitrary value.
- Similar examples include:
- The example combobox on this page implements the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the combobox design pattern.
-
- NOTE: When visual focus is in the listbox, DOM focus remains on the textbox and the value of
- The button has been removed from the tab sequence of the page, but is still important to assistive technologies for mobile devices that use touch events to open the list of options.
-
- The example combobox on this page implements the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the combobox design pattern.
-
- The below combobox that enables users to choose a term from a hypothetical list of previously searched terms demonstrates the
- ARIA design pattern for combobox.
- The design pattern describes four types of autocomplete behavior.
- This example illustrates the autocomplete behavior known as Similar examples include:
- The example combobox on this page implements the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the combobox design pattern.
-
- NOTE: When visual focus is in the listbox, DOM focus remains on the textbox and the value of
- The button has been removed from the tab sequence of the page, but is still important to assistive technologies for mobile devices that use touch events to open the list of options.
-
- The example combobox on this page implements the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the combobox design pattern.
-
- The below date picker demonstrates an implementation of the combobox design pattern that opens a dialog.
- The date picker dialog is opened by activating the choose date button or by moving keyboard focus to the combobox and pressing Down Arrow or Alt + Down Arrow.
- The dialog contains an implementation of the grid pattern for displaying a calendar and enabling selection of a date.
- Additional buttons in the dialog are available for changing the month and year shown in the grid.
- Similar examples include:
- Note: Since the names of the days of the week in the column headers are abbreviated to two characters, they may be difficult to understand when announced by a screen reader.
- An alternative column header name can be provided to screen readers by applying the
- The following example implementation of the ARIA design pattern for combobox
- demonstrates a single-select combobox widget that is functionally similar to an HTML Similar examples include: While the functionality and user experience of this example are nearly equivalent to an HTML
- The example combobox on this page implements the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the combobox design pattern.
-
- NOTE: When visual focus is in the listbox, DOM focus remains on the combobox and the value of
- The example combobox on this page implements the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the combobox design pattern.
-
- The following example combobox implements the
- combobox design pattern
- using a grid for the suggested values popup.
-
- In this example, users can specify the name of a fruit or vegetable by either typing a value in the box or choosing from the set of values presented in a grid popup.
- The popup becomes available after the textbox contains a character that matches the beginning of the name of one of the items in the set of value suggestions.
- Users may type any value in the textbox; this implementation does not limit input to values that are in the set of value suggestions.
-
- The grid that presents suggested values has two columns.
- Each row of the grid represents one suggestion; column one contains the name of the fruit or vegetable and column two identifies whether it is a fruit or vegetable.
- Similar examples include: Browsers do not manage visibility of elements referenced by
- The example combobox on this page implements the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the combobox design pattern.
-
- NOTE: When visual focus is in the grid, DOM focus remains on the textbox and the value of
- The example comboboxes on this page implement the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the combobox design pattern.
-
- The example below includes a date input field and a button that opens a date picker that implements the dialog design pattern.
- The dialog contains a calendar that uses the grid pattern to present buttons that enable the user to choose a day from the calendar.
- Choosing a date from the calendar closes the dialog and populates the date input field.
- When the dialog is opened, if the input field is empty, or does not contain a valid date, then the current date is focused in the calendar.
- Otherwise, the focus is placed on the day in the calendar that matches the value of the date input field.
- Similar examples include:
- Note: Since the names of the days of the week in the column headers are abbreviated to two characters, they may be difficult to understand when announced by a screen reader.
- An alternative column header name can be provided to screen readers by applying the
- Following is an example implementation of the
- design pattern for modal dialogs.
- The below Similar examples include: This is just a demonstration. If it were a real application, it would
- provide a message telling whether the entered address is valid.
- For demonstration purposes, this dialog has a lot of text. It demonstrates a
- scenario where:
- There are several ways to resolve this issue:
- Please DO NOT make the element with role dialog focusable!
-
- In this dialog, the first paragraph has
- The address you provided has been added to your list of delivery addresses. It is ready
- for immediate use. If you wish to remove it, you can do so from
- your profile.
-
- You activated a fake link or button that goes nowhere!
- The link or button is present for demonstration purposes only.
-
- The following example demonstrates using the
- disclosure design pattern
- to create a set of frequently asked questions where the answers may be independently shown or hidden.
- Similar examples include:
- The following example demonstrates using the
- disclosure design pattern
- to provide a way of revealing a table of data that complements an image.
- Similar examples include:
- Figurative Map of the successive losses in men of the French Army in the Russian campaign 1812-1813.
- Drawn by Mr. Minard, Inspector General of Bridges and Roads in retirement.
- Paris, 20 November 1869.
-
- The numbers of men present are represented by the widths of the colored zones in a rate of one millimeter for ten thousand men; these are also written beside the zones.
- Red designates men moving into Russia, black those on retreat.
-
- The information used for drawing the map were taken from the works of Messrs. Thiers, de Ségur, de Fezensac, de Chambray and the unpublished diary of Jacob, pharmacist of the Army since 28 October.
-
- In order to facilitate the judgement of the eye regarding the diminution of the army, I supposed that the troops under Prince Jèrôme and under Marshal Davoust, who were sent to Minsk and Mobilow and who rejoined near Orscha and Witebsk, had always marched with the army.
- Note: A French translation from Wikipedia.
- Although this example uses the word "menu" in the colloquial sense to refer to a set of navigation links, it does not use the WAI-ARIA menu role.
- That is because the menu and menubar roles require complex functionality, such as composite widget focus management and first-character navigation, that is unnecessary for typical site navigation.
-
- The following example demonstrates using the
- disclosure design pattern
- to show and hide dropdown lists of links in a navigation bar for a mythical university web site.
- Unlike the other disclosure navigation menu example, this example includes top-level links alongside the disclosure buttons.
- Similar examples include:
- This example demonstrates two different ways of implementing keyboard support.
- Toggle between them with the following checkbox.
- Sample content section. Activating a link above will update and navigate to this region.
- Although this example uses the word "menu" in the colloquial sense to refer to a set of navigation links, it does not use the WAI-ARIA menu role.
- That is because the menu and menubar roles require complex functionality, such as composite widget focus management and first-character navigation, that is unnecessary for typical site navigation.
-
- The following example demonstrates using the
- disclosure design pattern
- to show and hide dropdown lists of links in a navigation bar for a mythical university web site.
- Each disclosure button represents a section of the web site, and expanding it shows a list of links to pages within that section.
- Similar examples include:
- This example demonstrates two different ways of implementing keyboard support.
- Toggle between them with the following checkbox.
- Sample content section. Activating a link above will update and navigate to this region.
- NOTE: The feed role is a new WAI-ARIA feature, introduced by WAI-ARIA 1.1.
- This page provides a proposed implementation of a feed component.
- This proposal does not yet have ARIA Practices Task Force consensus.
- Feedback is welcome in
- issue 565.
-
- The example below implements the
- feed design pattern.
- for a restaurant review site.
- To imitate an infinitely scrolling set of data, information about ten restaurants is repeatedly loaded as the user reads the feed.
- Outside of the feed, an article load time selector is available for simulating data fetch delays.
-
- Unlike other examples in the WAI-ARIA Authoring Practices, the example experience has its own page separate from this documentation page.
-
- The example feed experience is presented on a separate
- feed display page.
- The following Javascript and CSS is used by the feedDisplay.html page: Please open feedDisplay.html and view source.
- The following examples demonstrate how the
- grid design pattern
- can be used to group a collection of interactive widgets into a single tab stop.
- In these examples, each widget, such as a link or button, is in a separate cell of the grid, and the user can navigate between them with the arrow keys.
- While navigating with the arrow keys, widgets receive keyboard focus and can be activated with Space or Enter.
-
- In addition to streamlining keyboard interfaces, these grids also convey logical grouping and semantic relationships for the elements they contain.
- For people who can see the screen, these groupings and relationships are visually communicated with layout and other elements of the visual design.
- And, by navigating the logical structure that a grid widget provides, screen reader users are also able to easily perceive the same semantic relationships.
-
- The distinguishing feature of Similar examples include: This example presents a list of links titled "Related Documents" in a grid.
- Add recipients by typing a string in the "New Recipient Name" field and pressing Enter or activating the "Add" button.
- See how this grid behaves as the number of elements increases.
-
- This example demonstrates how a grid can make moving through an infinitely large data set as easy and efficient for keyboard users as it is for mouse users.
- It presents a hypothetical set of search results for W3C resources about WAI-ARIA.
-
- This implementation of grid allows the following focus movement behaviors to be declared in the HTML.
-
- The example JavaScript allows the desired focus placement and wrapping behavior to be declared in the HTML content as follows.
-
- NOTE: The following table describes keyboard commands that move focus among grid cells.
- In the examples on this page, some cells contain a single focusable widget, and if a cell contains a widget, the cell is not focusable; the widget receives focus instead of the cell.
- So, when a description says a command moves focus to a cell, the command may either focus the cell or a widget inside the cell.
-
- This example has not yet been developed.
- Development is described in
- issue 155.
-
- This implementation of the
- design pattern for grid
- demonstrates how to implement a grid that has functionality similar to a spreadsheet.
- Similar examples include: This is the place where the reader will experience the functioning example. Please replace this content with a list of accessibility features
- demonstrated in this implementation, such as:
- Following are three example implementations of the
- design pattern for grid
- that demonstrate the keyboard interactions and ARIA features that enable accessible, interactive presentation
- of tabular information. Each of the following three grids presents a set of financial
- transactions. The first is a simple grid with minimum ARIA markup and keyboard support. The
- second and third implementations add advanced features, such as content editing, sort, scroll,
- and show/hide.
- Similar examples include:
- This page includes the following indexes of example implementations of
- ARIA design patterns included in
- WAI-ARIA Authoring Practices 1.2.
-
- Note: This is an illustrative example of one way of using ARIA that conforms with the ARIA specification.
-
- The examples below demonstrate three variations of the
- design pattern for link.
- The link pattern is used when it is necessary for elements other than the HTML
- Note: Use the HTML DEPRECATION WARNING: This pattern has been deprecated, and will be removed in a future version of the ARIA Authoring Practices. The select-only combobox should be used as an alternative to this pattern.
- The following example implementation of the
- design pattern for listbox
- demonstrates a collapsible single-select listbox widget that is functionally similar to an HTML Similar examples include: Choose your favorite transuranic element (actinide or transactinide). This listbox is scrollable; it has more options than its height can accommodate.
- The example listbox on this page implements the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the Listbox Design Pattern.
-
- The example listbox on this page implements the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the Listbox Design Pattern.
-
- The following example implementation of the design pattern for listbox demonstrates a single-select listbox widget with grouped options.
- This widget is functionally similar to an HTML Similar examples include: This listbox is scrollable; it has more options than its height can accommodate.
- The example listboxes on this page implement the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the Listbox Design Pattern.
-
- The example listboxes on this page implement the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the Listbox Design Pattern.
-
- The following two example implementations of the
- design pattern for listbox
- demonstrate differences between single-select and multi-select functionality.
- In both examples, users can use action buttons to move options from one list to another.
- In the first implementation, users can choose a single option and then activate an action button
-while in the second example, they may select multiple options before activating an action button.
- Similar examples include: Rank features important to you when choosing where to live. If a feature is unimportant, move it to the unimportant features list. Choose upgrades for your transport capsule.
- The example listboxes on this page implement the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the Listbox Design Pattern.
-
- The example listboxes on this page implement the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the Listbox Design Pattern.
-
- The following example implementation of the
- design pattern for listbox
- demonstrates a scrollable single-select listbox widget.
- This widget is functionally similar to an HTML Similar examples include: Choose your favorite transuranic element (actinide or transactinide). This listbox is scrollable; it has more options than its height can accommodate.
- The example listboxes on this page implement the following keyboard interface.
- Other variations and options for the keyboard interface are described in the
- Keyboard Interaction section of the Listbox Design Pattern.
-
- The example listboxes on this page implement the following ARIA roles, states, and properties.
- Information about other ways of applying ARIA roles, states, and properties is available in the
- Roles, States, and Properties section of the Listbox Design Pattern.
-
- The following example demonstrates using the
- menubar design pattern
- to provide access to editing actions for a text area.
- Each item in the menubar identifies a category of text formatting actions that can be executed from its submenu.
- The submenus demonstrate Similar examples include: CAUTION! Before considering use of the ARIA menubar pattern for site navigation, it is important to understand:
- The following implementation of the
- design pattern for menubar
- demonstrates how a menubar can provide navigation menus.
- The parent menu items in the menubar represent a section of a mythical university web site and open a submenu containing menu items that link to pages within that section.
- The navigation system it illustrates is comparable to the navigation illustrated in the Example of Disclosure for Navigation Menus.
- As noted above, the disclosure pattern is better suited for most web sites because few sites need the additional keyboard functionality required to support the ARIA Similar examples include: The following example of a CPU meter demonstrates the meter design pattern. The value of this meter changes every 5 seconds. Use the pause button to stop changes.
- Not applicable.
- Following is an example of a rating input that demonstrates the
- Radio Group Design Pattern.
- The rating is indicated by the number of stars selected by the user.
- Similar examples include:
- WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
- To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
- This is a new convention that may not be fully implemented by some assistive technologies.
- Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
-
- Following is an example of a color viewer that demonstrates the
- slider design pattern.
- Change the background of the color view box by adjusting the sliders for red, green, and blue values.
- The HEX and RGB values of the chosen color are displayed by the color view box.
- Similar examples include:
- WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
- To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
- This is a new convention that may not be fully implemented by some assistive technologies.
- Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
-
- Following is an example of a rating input that demonstrates the
- slider design pattern.
- This rating widget employs a slider because the slider pattern supports step values of any size.
- This particular input enables half-star steps.
- A typical five-star rating widget that allows only five possible values could instead be implemented as a
- radio group.
- Similar examples include:
- WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
- To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
- This is a new convention that may not be fully implemented by some assistive technologies.
- Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
-
- The following example of the
- slider design pattern
- illustrates a seek control that could be used to move the current play position in an audio or video media player.
- The example demonstrates how to use Similar examples include:
- WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
- To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
- This is a new convention that may not be fully implemented by some assistive technologies.
- Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
-
- The following example is a vertically oriented temperature control that implements the
- slider design pattern.
- The slider illustrates use of Similar examples include:
- The following example uses the Spin Button Design Pattern to implement a date picker.
- It includes three spin buttons: one for setting the day, a second for month, and a third for year.
- Similar examples include: The spin buttons provide the following keyboard support described in the spin button design pattern.
- This example illustrates implementing the switch design pattern with an HTML Similar examples include:
- This example illustrates implementing the Switch design pattern with an HTML Similar examples include:
- This example illustrates implementation of the switch design pattern for a notification preferences control.
- It uses a Similar examples include:
- The example below illustrates an implementation of the table design pattern for a table with sortable rows.
- The example uses HTML table markup for all elements of the table structure, e.g., cells, rows, column headers, and caption.
- The Similar examples include:
- Adds a diamond shaped icon (e.g. Not applicable: The only interactive elements are HTML button elements, and all their keyboard functionality is provided by browsers.
- The below example illustrates an implementation of the WAI-ARIA
- table design pattern.
- Note that when possible, using a native HTML Similar examples include: Not Applicable Learn more about toolbar behaviors by reading the ARIA Authoring Practices Guide.
- The following example of an editor toolbar implements the
- design pattern for toolbar
- and demonstrates how a toolbar can group a set of interactive widgets into a single tab stop.
- For illustrative and interoperability assessment purposes, this implementation includes a diverse set of widgets, some of which may not be ordinarily grouped in the same toolbar.
- For instance, it includes both a checkbox and toggle buttons. In a typical implementation, the design would use either one or the other but not both.
- Similarly, the edit field is included to help simulate actual implementation and is not intended to represent an actual rich text editor.
- This example also illustrates the roving tabindex method for managing focus within a component.
- The bold, italic, underline, and text align buttons have popup labels that implement the requirements of WCAG Success Criterion 1.4.13 Content on Hover or Focus: The toolbar provides the following keyboard support described in the toolbar pattern. The toggle buttons for choosing to apply Bold, Italic, and Underline styling provide the following keyboard support described in the button design pattern.
- The buttons for choosing left, center, or right text alignment are styled like toggle buttons.
- However, since pressing one toggles off another so that only one button in the group is in the pressed state, the toggles behave like radio buttons.
- Because ARIA is designed to inform assistive technologies about UI semantics and behaviors, not styling,
- the alignment toggles provide the following keyboard support described in the radio group design pattern.
- As described in the pattern, nesting a radio group in a toolbar calls for an important behavioral difference compared to radios outside a toolbar: moving focus inside the group does not automatically change which button is checked.
- In addition, because Left Arrow and Right Arrow are needed by the parent toolbar, they are not captured by the radio group.
- The toolbar thus provides navigation into, inside, and out of the nested radio group.
-
- The buttons for cut, copy, and paste provide the following keyboard support described in the button design pattern.
- While they are HTML button elements, as described in the accessibility features section above, in order to remain focusable when disabled, they have The menu button for opening the font family menu provides the following keyboard support described in the menu button design pattern. The menu for choosing a font family provides the following keyboard support described in the Menu design pattern. The spin button for changing font size provides the following keyboard support described in the spin button design pattern.
- The checkbox for toggling night mode provides the following keyboard support defined in the checkbox design pattern.
- As an HTML input element, the browser provides the keyboard support.
-
- The link for opening a help page provides the following keyboard support described in the link design pattern.
- As an HTML link, the keyboard support is provided by the browser.
- The toolbar implements the following ARIA attributes described in the toolbar pattern. The toggle buttons for choosing to apply Bold, Italic, and Underline styling implement the following ARIA attributes described in the button design pattern.
- The buttons for choosing left, center, or right text alignment are styled like toggle buttons.
- However, since pressing one toggles off another so that only one button in the group is in the pressed state, the toggles behave like radio buttons.
- Because ARIA is designed to inform assistive technologies about UI semantics and behavior, not styling,
- the alignment toggles implement the following ARIA attributes described in the radio group design pattern.
-
- The buttons for cut, copy, and paste implement the following ARIA attributes described in the button design pattern.
- While they are HTML button elements, as described in the accessibility features section above, in order to remain focusable when disabled, they have The menu button for opening the font family menu implements the following ARIA attributes described in the menu button design pattern. The menu for choosing a font family implements the following ARIA attributes described in the Menu design pattern. The spin button for changing font size implements the following ARIA attributes described in the spin button design pattern.
- NOTE: This example is new in APG 1.1 release 2.
- Please provide feedback in
- issue 790.
-
- The following example demonstrates how the
- treegrid design pattern
- can be used to make an interactive tree that enables users to both navigate the hierarchical structure of email conversations
- and also navigate elements that describe each email, such as subject and sender.
- Similar examples include:
- This example demonstrates three different ways of implementing the keyboard navigation specified in the treegrid pattern.
- The following links change the behavior of the navigation keys :
-
- Note: A row-only option is not provided.
- A treegrid where cells cannot be focused would be implemented as a tree view.
- A treeview that has columns in its visual presentation may be appropriate when all the following conditions are present:
-
- NOTE: The following table includes descriptions of how keyboard commands move focus among cells and rows in the treegrid implementation on this page.
- In the example on this page, some cells contain a single focusable widget, and if a cell contains a widget, the cell is not focusable; the widget receives focus instead of the cell.
- So, when a keyboard command description says a command moves focus to a cell, the command may either focus the cell or a widget inside the cell.
-
- NOTE: Due to an error in the ARIA 1.1 specification, the
- The following example implementation of the
- Tree View Design Pattern
- simulates a widget for selecting a file or folder from within a hierarchical file system for viewing in a file viewer.
- In the
- The code in this example explicitly declares values for Similar examples include:
- To make the focus indicator easier to see, nodes in the tree have custom focus and hover styling created using CSS focus and hover pseudo-classes.
-
- A tree item that can be expanded to reveal child items is called a parent node.
- It is a closed node when the children are hidden and an open node when it is expanded.
- An end node does not have any children.
- For a complete list of terms and definitions, see the
- Treeview Design Pattern.
-
- Note that in this example, selection and focus are distinct; moving focus does not change which node is selected.
- Because selection does not follow focus, keyboard and screen reader users can navigate and explore the tree without changing the content of the file viewer.
- To learn more about this aspect of the design, read the guidance section about Deciding When to Make Selection Automatically Follow Focus.
-
- Learn to use the accessibility semantics defined by the Accessible Rich Internet Application (ARIA) specification to create accessible web experiences.
- This guide describes how to apply accessibility semantics to common design patterns and widgets.
- It provides design patterns and functional examples complemented by in-depth guidance for fundamental practices.
- Building blocks that help you make the web accessible
- Learn how to make accessible web components and widgets with ARIA roles, states and properties and by implementing keyboard support.
- One or more ways of implementing each pattern is demonstrated with a functional example.
-
- Learn how to use HTML sectioning elements and ARIA landmark roles
- to make it easy for assistive technology users to understand the
- meaning of the layout of a page.
-
- Providing elements with accessible names and, where appropriate,
- accessible descriptions is one of the most important
- responsibilities authors have when developing accessible web
- experiences.
-
- Learn about other fundamental practices related to correctly using accessibility semantics,
- developing keyboard interfaces, and more.
- Check out recent work of the APG Task Force
- Take a look at the plan overview for WAI-ARIA Authoring Practices,
- priorities and work in progress.
-
- Status of work on design patterns and reference implementations of
- those patterns for the first release of the ARIA 1.1 Authoring
- Practices.
-
- Learn what the APG Regression Tests test, how to run them and
- understand the results.
-
- The APG Task Force meets on Tuesdays at 14:00 until 15:00 Eastern
- Time. Minutes from previous meetings are available.
-
- The APG Task Force relies on broad community representation and participation to continuously improve the usefulness and quality of the APG.
- There are a variety of ways you can get involved and help promote development of accessible experiences.
-
- To join the APG Task Force, individuals need to first join the W3C ARIA Working Group.
- Participants are expected to actively contribute to the work of the task force.
-
- Many valuable contributions are made by people who find or raise issues of interest in our GitHub repository and then submit proposed changes via a GitHub pull request.
- If you choose this path, please start by studying our guidelines for contributing to the repository and maintaining code quality.
-
- The APG Task Force uses the public aria-practices mailing list for email discussion.
- Meeting announcements, agendas, and links to minutes are sent to the mailing list.
- While GitHub issues are the preferred place to discuss APG content, the mailing list is available to anyone who would prefer to communicate with the APG Task Force via email.
-
-
- View the aria-practices mailing list archive
-
-
- This page includes information on number of guidance and example references in the WAI-ARIA Authoring Practices for each ARIA role, property and state. The guidance column is determined
- by either the role, property or state being in the text content of a heading (e.g.
+ The APG Task Force uses the reports on this page to help plan content improvements.
+ The reports provide data about the scope and quality of content in the APG.
+ The data delineates:
+
+ The data in the reports are generated by a script
+ that is run by a GitHub action workflow
+ when the main branch of the aria-practices repository is updated.
+ The script will indicate that an ARIA attribute has guidance in a pattern or practice if any of the following conditions are met:
+
+ If either of the data attributes is specified on a heading, the content of that heading will not be processed.
+ In the generated report, the suffix "(D)" indicates a reference came from a data attribute, otherwise the reference came from the text content of a heading.
+
+ The following files and reports are generated:
+
- This page includes the following indexes of example implementations of
- ARIA design patterns included in
- WAI-ARIA Authoring Practices 1.2.
+ This page includes a list of all ARIA design pattern examples indexed
+ either by role or by ARIA properties and states.
alertdialog
so referencing that example may be useful.
+
+ About This Example
+
-
+
+
+ alertdialog
role.
+
+
+
+
+
+
+ Example
@@ -77,22 +80,23 @@ Example
Confirmation
Accessibility Features
@@ -103,11 +107,12 @@
Accessibility Features
This is the least destructive action, so focusing "No" helps prevent users from accidentally confirming the destructive "Discard" action, which cannot be undone.
aria-disabled
is used instead of the HTML disabled
attribute so the buttons will remain in the page Tab sequence.
- This makes it easier for screen reader users to discover the buttons and discern how the interface works.
+ When the buttons are disabled, aria-disabled
is used instead of the HTML disabled
attribute so the buttons will remain in the page Tab sequence.
+ This makes it easier for screen reader users to discover the buttons and discern how the interface works.
Keyboard Support
@@ -118,7 +123,7 @@
Keyboard Support
-
+
- Tab
@@ -136,7 +141,7 @@
Keyboard Support
+
@@ -144,15 +149,16 @@ Escape
Closes the dialog.
Keyboard Support
Command + S
(Mac only) Save the contents of the notes
- textarea
when focused.
+
Control + S
(Windows only) Save the contents of the notes
textarea
when focused.Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
-
@@ -163,47 +169,37 @@
- Role, Property, State, and Tabindex Attributes
+
- alertdialog
- div
- Identifies the element that serves as the alert dialog container.
-
+ Identifies the element that serves as the alert dialog container.
+
-
aria-labelledby="ID_REFERENCE"
- div
- Gives the alert dialog an accessible name by referring to the element that provides the alert dialog title.
-
+ Gives the alert dialog an accessible name by referring to the element that provides the alert dialog title.
+
-
aria-describedby="ID_REFERENCE"
- div
- Gives the alert dialog an accessible description by referring to the alert dialog content that describes the primary message or purpose of the alert dialog.
-
+ Gives the alert dialog an accessible description by referring to the alert dialog content that describes the primary message or purpose of the alert dialog.
+
+
aria-modal="true"
- div
- Tells assistive technologies that the windows underneath the current alert dialog are not available for interaction (inert).
-
+ Tells assistive technologies that the windows underneath the current alert dialog are not available for interaction (inert).
+
+
-
+ alert
+
+ div
Identifies the element that serves as the alert notification.
-
-
- alert
-
- div
- Identifies the element that serves as the alert notification.
-
-
+
aria-disabled="true"
@@ -217,9 +213,7 @@ button
Notes on
The aria-modal
and aria-hidden
aria-modal
property was introduced in ARIA 1.1.
As a relatively new property, screen reader users may experience varying degrees of support for it.
- aria-modal
property to the dialog
element replaces the technique of using aria-hidden
on the background for informing assistive technologies that content outside a dialog is inert.
- aria-modal
property to the dialog
element replaces the technique of using aria-hidden
on the background for informing assistive technologies that content outside a dialog is inert.aria-hidden
is used to make content outside a dialog inert for assistive technology users, it is important that:
@@ -229,13 +223,15 @@
Notes on
aria-modal
and aria-hidden
Javascript and CSS Source Code
-
HTML Source Code
@@ -247,8 +243,5 @@ HTML Source Code
Menu
+ Menu
-
@@ -130,8 +130,8 @@
@@ -153,7 +153,7 @@ Menu
Last Action
textbox to be updated.Menu
-
+
Down Arrow
@@ -184,7 +184,7 @@
Menu
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
Menu Button
@@ -226,17 +226,20 @@
@@ -306,7 +309,6 @@ Menu Button
-
-
- aria-expanded="true"
- button
-
+
-
- aria-expanded
attribute is removed when the menu is closed.
+
+ aria-expanded="true"
+ button
+
+
+ aria-expanded
attribute is removed when the menu is closed.Menu
Javascript and CSS Source Code
HTML Source Code
-
Navigation Menu Button Example
- button
element reveals a menu structure made with an HTML ul
element.
- The menuitem
role is on the HTML a
element contained by each li
element so link behaviors are available when focus is set on the menu item.
- Another reason for applying the menuitem
role to the a
element instead of the li
element is that the semantics of descendants of menuitem
elements are not exposed in the accessibility tree.
- That is, an item in a menu can only be a menuitem
because accessibility APIs do not enable assistive technologies to render elements contained inside of an item in a menu.
- For a more detailed description of this constraint, see
- Roles That Automatically Hide Semantics by Making Their Descendants Presentational.
-
-
+
+ element.focus()
.About This Example
+ button
element reveals a menu structure made with an HTML ul
element.
+ The menuitem
role is on the HTML a
element contained by each li
element so link behaviors are available when focus is set on the menu item.
+ Another reason for applying the menuitem
role to the a
element instead of the li
element is that the semantics of descendants of menuitem
elements are not exposed in the accessibility tree.
+ That is, an item in a menu can only be a menuitem
because accessibility APIs do not enable assistive technologies to render elements contained inside of an item in a menu.
+ For a more detailed description of this constraint, see
+ Roles That Automatically Hide Semantics by Making Their Descendants Presentational.
+
+
+ element.focus()
.Example
@@ -53,47 +56,31 @@ Example
Example
Accessibility Features
+
Menu Button
- Menu
+ Menu
-
@@ -155,9 +143,7 @@
Menu
Space
-
Enter
- Activates the menu item, which is equivalent to activating the link element from which the menu item is made.
-
+ Activates the menu item, which is equivalent to activating the link element from which the menu item is made.
- Escape
@@ -177,7 +163,7 @@ Menu
+
Down Arrow
@@ -207,8 +193,8 @@
Menu
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
Menu Button
@@ -250,17 +236,20 @@
@@ -313,7 +302,9 @@ Menu Button
-
-
- aria-expanded="true"
- button
-
+
-
- aria-expanded
attribute is removed when the menu is closed.
+
+ aria-expanded="true"
+ button
+
+
+ aria-expanded
attribute is removed when the menu is closed.Menu
@@ -352,24 +343,17 @@
listitem
role of the li
element from assistive technologies.presentation
Role.presentation
Role.
+ Javascript and CSS Source Code
HTML Source Code
-
Menu Button Pattern
+
+ About This Pattern
+ Examples
+
+
+ button
element that opens a menu of actions or commands where focus in the menu is managed using element.focus()
.a
element that opens a menu of items that behave as links.Keyboard Interaction
+
+
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+ button
has aria-haspopup set to either menu
or true
.button
has aria-expanded set to true
.
+ When the menu is hidden, it is recommended that aria-expanded
is not present.
+ If aria-expanded
is specified when the menu is hidden, it is set to false
.
+ button
has a value specified for aria-controls that refers to the element with role menu
.
+ Editor Menubar Example
+
+ About This Example
+ menuitemradio
and menuitemcheckbox
elements.
+
+
+ Example
+ Accessibility Features
+
+
+ Smaller
menu item is disabled.
+ Similarly, if the font is set to its largest size, the Larger
menu item is disabled.
+ aria-hidden
attribute.
+
+ Keyboard Support
+ Menubar
+
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Space
+
EnterOpens submenu and moves focus to first item in the submenu.
+
+
+
+ Escape
+
+
+ If a submenu is open, closes it.
+ Otherwise, does nothing.
+
+
+
+
+ Right Arrow
+
+
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+
+
+ Down Arrow
+
+ Opens submenu and moves focus to first item in the submenu.
+
+
+
+ Up Arrow
+
+ Opens submenu and moves focus to last item in the submenu.
+
+
+
+ Home
+
+ Moves focus to first item in the menubar.
+
+
+
+ End
+
+ Moves focus to last item in the menubar.
+
+
+
+
+ Character
+
+
+
+
+
+ Submenu
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Space
+
EnterActivates menu item, causing action to be executed, e.g., bold text, change font.
+
+
+
+ Escape
+
+
+
+
+
+
+
+
+ Right Arrow
+
+
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+
+
+ Down Arrow
+
+
+
+
+
+
+
+
+ Up Arrow
+
+
+
+
+
+
+
+
+ Home
+
+ Moves focus to the first item in the submenu.
+
+
+
+ End
+
+ Moves focus to the last item in the submenu.
+
+
+
+
+ Character
+
+
+
+
+
+ Role, Property, State, and Tabindex Attributes
+ Menubar
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ menubar
+
+
+
+ ul
+
+
+
+
+ menubar
container for a set of menuitem
elements.
+
+
+
+
+ aria-label="string"
+
+
+ ul
+
+
+
+
+ menubar
.
+
+
+
+ menuitem
+
+
+
+ span
+
+
+
+
+
+
+
+
+
+ tabindex="-1"
+
+
+ span
+ Makes the
+ menuitem
element keyboard focusable but not part of the Tab sequence of the page.
+
+
+
+
+ tabindex="0"
+
+
+ span
+
+
+
+
+ menuitem
element keyboard focusable and part of the tab sequence of the page.menuitem
in the menubar
has tabindex="0"
.tabindex="0"
.
+
+
+
+
+ aria-haspopup="true"
+
+
+ span
+ Indicates that the
+ menuitem
has a submenu.
+
+
+
+
+ aria-expanded="true"
+
+
+ span
+
+
+
+
+ aria-expanded
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
+
+
+
+
+ aria-expanded="false"
+
+
+ span
+
+
+
+
+ aria-expanded
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
+
+
+
+
+
+ aria-hidden="true"
+
+
+ span
+ Removes the character entities used to represent the down arrow icons for parent menu items from the accessibility tree to prevent them from being included in the accessible name of the menu item.
+ Submenu
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ menu
+
+
+
+ ul
+
+
+
+
+
+
+
+
+
+ aria-label="string"
+
+
+ ul
+ Defines an accessible name for the
+ menu
.
+
+
+
+ menuitem
+
+
+
+ li
+
+
+
+
+
+
+
+
+
+ tabindex="-1"
+
+
+ li
+ Makes the item focusable but not part of the page tab sequence.
+
+
+
+
+
+ aria-disabled="false"
+
+
+ li
+ Used on the font size "Smaller" and "Larger" options to indicate they are active.
+
+
+
+
+
+ aria-disabled="true"
+
+
+ li
+ Used on the font size "Smaller" and "Larger" options to indicate one of the options is not active because the largest or smallest font has been selected.
+
+
+
+
+ menuitemcheckbox
+
+
+
+ li
+
+
+
+
+ menuitemcheckbox
.
+
+
+
+
+ tabindex="-1"
+
+
+ li
+ Makes the menuitemcheckbox focusable but not part of the page tab sequence.
+
+
+
+
+
+ aria-checked="true"
+
+
+ li
+
+
+
+
+ menuitemcheckbox
is checked.aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
+
+
+
+
+ aria-checked="false"
+
+
+ li
+
+
+
+
+ menuitemcheckbox
is NOT checked.aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
+
+
+
+
+ aria-hidden="true"
+
+
+ span
+ Removes the character entities that visually represent the checked state of
+ menuitemcheckbox
elements from the accessibility tree to prevent them from being included in the accessible name of the menu item.
+
+
+
+ separator
+
+
+
+ li
+
+
+
+
+ menuitemradio
or menuitemcheckbox
elements.
+
+
+
+ group
+
+
+
+ ul
+
+
+
+
+ menuitemradio
elements.aria-setsize
and aria-posinset
.
+
+
+
+
+ aria-label="string"
+
+
+ ul
+ Provides an accessible name for the group of menu items.
+
+
+
+
+ menuitemradio
+
+
+
+ li
+
+
+
+
+ menuitemradio
element.menu
element; a group
element is not necessary.
+
+
+
+
+ tabindex="-1"
+
+
+ li
+ Makes the menuitemradio focusable but not part of the page tab sequence.
+
+
+
+
+
+ aria-checked="true"
+
+
+ li
+
+
+
+
+ menuitemradio
is checked.aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
+
+
+
+
+ aria-checked="false"
+
+
+ li
+
+
+
+
+ menuitemradio
is NOT checked.aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
+
+
+
+
+
+ aria-hidden="true"
+
+
+ span
+ Removes the character entities that visually represent the checked state of
+ menuitemradio
elements from the accessibility tree to prevent them from being included in the accessible name of the menu item.Textarea
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+
+
+ aria-label="string"
+
+
+ textarea
+ Defines an accessible name for the
+ textarea
.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Navigation Menubar Example
+
+ About This Example
+ Caution!
+
+
+ menubar
pattern requires complex functionality that is unnecessary for typical site navigation that is styled to look like a menubar with expandable sections or fly outs
.menubar
and menu
roles.
+
+
+ Example
+ Mythical University
+ Accessibility Features
+
+
+
+
+
+
+
+
+ currentcolor
value for the fill
and stroke
properties of the SVG polygon
element is used to synchronize the color with text content.
+ If specific colors are used to specify the fill
and stroke
properties, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the icon and the background or even make the icon invisible if its color matches the high contrast mode background.
+ nav
element that has an aria-label
that matches the label on the menubar.Keyboard Support
+ Menubar
+
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Space
+
Enter
+
+
+
+
+
+
+ Right Arrow
+
+
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+
+
+ Down Arrow
+
+ Opens submenu and moves focus to first item in the submenu.
+
+
+
+ Up Arrow
+
+ Opens submenu and moves focus to last item in the submenu.
+
+
+
+ Home
+
+ Moves focus to first item in the menubar.
+
+
+
+ End
+
+ Moves focus to last item in the menubar.
+
+
+
+
+ Character
+
+
+
+
+
+ Submenu
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Space
+
Enter
+
+
+
+
+
+
+ Escape
+
+
+
+
+
+
+
+
+ Right Arrow
+
+
+
+
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+
+
+
+
+ Down Arrow
+
+
+
+
+
+
+
+
+ Up Arrow
+
+
+
+
+
+
+
+
+ Home
+
+ Moves focus to the first item in the submenu.
+
+
+
+ End
+
+ Moves focus to the last item in the submenu.
+
+
+
+
+ Character
+
+
+
+
+
+ Role, Property, State, and Tabindex Attributes
+
+ Landmarks
+
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ banner
+
+ header
+
+
+
+ banner
role declaration is only necessary because it is an example that is nested inside the content of this page.
+ In an actual website, the header element would be a top level element, i.e., it would have the body as its scope.
+ If the scope of the header element were body, browsers would automatically treat the header as an ARIA banner, so the header would not need role="banner"
.
+
+
+
+ navigation
+
+ nav
Identifies the region containing the mythical university navigation.
+
+
+
+
+ aria-label="Mythical University"
+ nav
Provides an accessible name for the
+ navigation
landmark that describes the purpose of the navigation.
+
+
+ region
+
+ section
+
+
+
+ main
landmark, but since this page already has a main landmark, role region
is used to avoid having two main
landmarks on the page.
+
+
+
+ aria-labelledby="idref"
+ section
Provides the region with an accessible name from the
+ h1
element.
+
+
+
+ contentinfo
+
+ footer
+
+
+
+ contentinfo
role declaration is only necessary because the footer is an example that is nested inside the content of this page.
+ In an actual website, the footer element would be a top level element, i.e., it would have the body as its scope.
+ If the scope of the footer element were body, browsers would automatically treat the footer as a ARIA contentinfo
landmark, so the footer would not need role="contentinfo"
.
+ Menubar
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ menubar
+
+
+
+ ul
+
+
+
+
+ menubar
container for a set of menuitem
elements.
+
+
+
+
+ aria-label="string"
+
+
+ ul
+
+
+
+
+ menubar
.
+
+
+
+ menuitem
+
+
+
+ a
+
+
+
+
+ a
element.
+
+
+
+
+ tabindex="-1"
+
+
+ a
+ Makes the
+ a
element keyboard focusable, but not part of the tab sequence.
+
+
+
+
+ tabindex="0"
+
+
+ a
+
+
+
+
+ tabindex="0"
.tabindex="0"
.
+
+
+
+
+ aria-current="page"
+
+
+ a
+
+
+
+
+ title
attribute with the text content of "Contains current page link" to indicate to screen reader users the menu item contains the current page link.
+
+
+
+
+ aria-haspopup="true"
+
+
+ a
+ Indicates the menuitem has a submenu.
+
+
+
+
+
+ aria-expanded="true"
+
+
+ a
+ Indicates the submenu is open.
+
+
+
+
+
+ aria-expanded="false"
+
+
+ a
+ Indicates the submenu is closed.
+
+
+
+
+
+ none
+
+
+
+ li
+
+
+
+
+ listitem
role of the li
element.ul
is serving as a menu
so the li
elements are not in their required list context.Submenu
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ menu
+
+
+
+ ul
+ Identifies the element as a menu container for a set of menu items.
+
+
+
+
+
+ aria-label="string"
+
+
+ ul
+
+
+
+
+ menu
.
+
+
+
+ menuitem
+
+
+
+ a
+
+
+
+
+ a
element.
+
+
+
+
+ tabindex="-1"
+
+
+ a
+ Keeps the
+ a
element focusable but removes it from the Tab sequence.
+
+
+
+
+ aria-haspopup="true"
+
+
+ a
+ Indicates the menu item has a submenu.
+
+
+
+
+
+ aria-expanded="true"
+
+
+ a
+ Indicates the submenu is open.
+
+
+
+
+
+ aria-expanded="false"
+
+
+ a
+ Indicates the submenu is closed.
+
+
+
+
+
+ none
+
+
+
+ li
+
+
+
+
+ listitem
role of the li
element.ul
is serving as a menu
so the li
elements are not in their required list context.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Menu and Menubar Pattern
+
+ About This Pattern
+ Examples
+
+
+ Keyboard Interaction
+
+
+ menubar
containing several menuitem
, menuitemradio
, or menuitemcheckbox
elements.menuitem
elements in the menubar
have child submenus that contain vertically arranged items.menuitem
elements in the submenus have child submenus with items that are also vertically arranged.
+
+ menuitem
, menuitemradio
, or menuitemcheckbox
, are referred to as items.menuitem
elements, the specific role name is used.menu
.menu
opens, or when a menubar
receives focus, keyboard focus is placed on the first item.
+ Because menubar
and menu
elements are composite widgets as described in the practice for
+ Keyboard Navigation Inside Components,
+ Tab and Shift + Tab do not move focus among the items in the menu.
+ Instead, the keyboard commands described in this section enable users to move focus among the elements in a menubar
or menu
.
+
+
+
+
+ menubar
:
+
+
+ menubar
for the first time, focus is set on the first menuitem
.menubar
has previously contained focus, focus is optionally set on the menuitem
that last had focus.
+ Otherwise, it is set on the first menuitem
that is not disabled.
+ menuitem
in a menu
or menubar
, move focus out of the menu
or menubar
, and close all menus and submenus.menu
.
+ Unlike a menubar
, a menu
is not visually persistent, and authors are responsible for ensuring focus moves to an item inside of a menu
when the menu
opens.
+
+
+ menuitem
that has a submenu, opens the submenu and places focus on its first item.
+
+ menuitemcheckbox
, changes the state without closing the menu.menuitemradio
that is not checked, without closing the menu, checks the focused menuitemradio
and unchecks any other checked menuitemradio
element in the same group.menuitem
that has a submenu, opens the submenu and places focus on its first item.menuitem
that does not have a submenu, activates the menuitem
and closes the menu.
+
+ menuitem
in a menubar
, and that menuitem
has a submenu, opens the submenu and places focus on the first item in the submenu.menu
, moves focus to the next item, optionally wrapping from the last to the first.
+
+ menu
, moves focus to the previous item, optionally wrapping from the first to the last.menuitem
in a menubar
, and that menuitem
has a submenu, opens the submenu and places focus on the last item in the submenu.
+
+ menubar
, moves focus to the next item, optionally wrapping from the last to the first.menu
and on a menuitem
that has a submenu, opens the submenu and places focus on its first item.menu
and on an item that does not have a submenu, performs the following 3 actions:
+
+
+ Note that if the menubar
.menuitem
with a submenu, either: (Recommended) opens the submenu of that menuitem
without moving focus into the submenu, or opens the submenu of that menuitem
and places focus on the first item in the submenu.menubar
were not present, e.g., the menus were opened from a menubutton, Right Arrow would not do anything when focus is on an item that does not have a submenu.
+
+
+ menubar
, moves focus to the previous item, optionally wrapping from the first to the last.menu
, closes the submenu and returns focus to the parent menuitem
.menubar
, performs the following 3 actions:
+
+
+ menubar
.menuitem
with a submenu, either: (Recommended) opens the submenu of that menuitem
without moving focus into the submenu, or opens the submenu of that menuitem
and places focus on the first item in the submenu.menu
or menubar
.menu
or menubar
.menuitem
, from which the menu was opened.Note
+
+
+ menuitem
elements that both perform a function and open a submenu.
+ In such implementations, Enter and Space perform a navigation function, e.g., load new content, while Down Arrow, in a horizontal menubar, opens the submenu associated with that same menuitem
.
+ menubar
are arranged vertically and items in menu
containers are arranged horizontally:
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+
+
+ menu
element is:
+
+
+ menu
element as its parent menuitem
.menuitem
.menu
or true
.false
when its child menu is not visible and set to true
when the child menu is visible.
+
+ tabindex
set to -1
or 0
and aria-activedescendant set to the ID of the focused item.tabindex
set to -1
, except in a menubar, where the first item has tabindex
set to 0
.true
.true
.menubar
has aria-labelledby set to a value that refers to the labelling element.
+ Otherwise, the menubar element has a label provided by aria-label.
+ vertical
.
+ The default value of aria-orientation
for a menubar is horizontal
.
+ menu
either has:
+
+
+ horizontal
.
+ The default value of aria-orientation
for a menu is vertical
.
+ Note
+ Meter Example
+
+ About This Example
+ Example
+ Central Processing Unit (CPU) Usage
+ Keyboard Support
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ meter
+
+
+ div
+
+
+
+
+ meter
.
+
+
+
+ aria-valuemin="NUMBER"
+ div
Specifies the minimum value the meter can have.
+
+
+
+
+ aria-valuemax="NUMBER"
+ div
Specifies the maximum value the meter can have.
+
+
+
+
+ aria-valuenow="NUMBER"
+ div
Specifies the current value of the meter.
+
+
+
+
+
+ aria-labelledby
+ div
Identifies the element that provides the accessible name of the
+ meter
.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Meter Pattern
+
+ About This Pattern
+ Note
+
+
+ meter
should not be used to represent a value like the current world population since it does not have a meaningful maximum limit.meter
should not be used to indicate progress, such as loading or percent completion of a task.
+ To communicate progress, use the progressbar role instead.
+ Example
+
+ Keyboard Interaction
+ WAI-ARIA Roles, States, and Properties
+
+
+ aria-valuemin
and aria-valuemax
representing the current value of the meter.aria-valuemax
.aria-valuemin
.aria-valuenow
as a percentage.
+ If conveying the value of the meter only in terms of a percentage would not be user friendly, the aria-valuetext property is set to a string that makes the meter value understandable.
+ For example, a battery meter value might be conveyed as aria-valuetext="50% (6 hours) remaining"
.
+ meter
.
+ Otherwise, the element with role meter
has a label provided by aria-label.
+ Radio Group Example Using aria-activedescendant
- aria-activedescendant
for informing assistive technologies which radio button has visual focus.
-
-
- tabindex
for managing keyboard focus.Example
- Pizza Crust
-
-
About This Example
+ aria-activedescendant
for informing assistive technologies which radio button has visual focus.
+
+
+ tabindex
for managing keyboard focus.Example
+ Pizza Crust
- Pizza Delivery
+
+
-
-
+ Pizza Delivery
-
+
+ Accessibility Features
-
aria-activedescendant
is scrolled into view when it is not visible in the graphical rendering. This can occur under many conditions, but is most common when people with visual impairments use a browser's zoom feature to increase the size of content.
- aria-checked
state with the visual state indicator.:hover
and :focus
pseudo-classes for styling visual keyboard focus and hover.
+ aria-activedescendant
is scrolled into view when it is not visible in the graphical rendering.
+ This can occur under many conditions, but is most common when people with visual impairments use a browser's zoom feature to increase the size of content.
+ aria-checked
state with the visual state indicator.:hover
and :focus
pseudo-classes for styling visual keyboard focus and hover.
Accessibility Features
When focusable elements are not focused, they have a 0-width border and additional padding equal in width to the border that is used to indicate focus.
forced-color-adjust
is set to auto
on the svg
graphics.
+ To ensure the inline SVG radio button graphics in the CSS file have sufficient contrast with the background when high contrast settings change the color of text content, CSS forced-color-adjust
is set to auto
on the svg
graphics.
This causes the colors of the stroke
and fill
of the circle elements to be overridden by the high contrast color setting.
To make the background of the circle
elements match the high contrast background color, the fill-opacity
attribute of the outer circle
is set to zero and the stroke-opacity
attribute of the inner circle
is set to zero.
If forced-color-adjust
were not used to override the colors specified for the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the radio circle elements and the background or even make them invisible if their color matched the high contrast mode background.
@@ -129,7 +101,7 @@ Keyboard Support
NOTE: When visual focus is on a radio button in the radio group, DOM focus remains on the radio group container and the value of aria-activedescendant
on the radio group refers to the radio button that is visually indicated as focused.
Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator, not DOM focus.
For more information about this focus management technique, see
- Using aria-activedescendant to Manage Focus.
+ Managing Focus in Composites Using aria-activedescendant.
@@ -182,8 +154,8 @@
Keyboard Support
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
@@ -225,10 +197,10 @@ Role, Property, State, and Tabindex Attributes
@@ -275,8 +247,8 @@ Role, Property, State, and Tabindex Attributes
Javascript and CSS Source Code
-
HTML Source Code
-
-
-
+
diff --git a/content/patterns/radio/examples/radio-rating.html b/content/patterns/radio/examples/radio-rating.html
new file mode 100644
index 0000000000..f279ab5875
--- /dev/null
+++ b/content/patterns/radio/examples/radio-rating.html
@@ -0,0 +1,297 @@
+
+
+
+
+
+ Rating Radio Group Example
+
+ About This Example
+
+
+ aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-activedescendant
for managing keyboard focus.tabindex
for managing keyboard focus.Example
+ Accessibility Features
+
+
+
+
+ currentcolor
value for the stroke
property of the inline SVG polygon
to draw the star borders and rect
element used to draw the focus ring border.
+ To make the background of the polygon
and rect
elements match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
+ If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the star and the background or even make them invisible if their color matched the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
+ Some browsers do not use auto
for the default value.
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Tab
+
+
+
+
+ radio
button in the radiogroup
.radio
button is not checked, focus moves to the first radio
button in the group.
+
+ Space
+
+
+
+
+ radio
button with focus is not checked, changes the state to checked
.
+
+ Down arrow
+
Right arrow
+
+
+
+ radio
button in the group.radio
button, moves focus to the first radio
button.
+
+
+ Up arrow
+
Left arrow
+
+
+
+ radio
button in the group.radio
button, moves focus to and checks the last radio
button.Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attributes
+ Element
+ Usage
+
+
+
+
+ none
+
+
+
+ svg
+ The use of the
+ none
role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
+
+
+ radiogroup
+
+ div
+
+
+
+ div
element as a container for a group of radio
buttons.
+
+
+
+ aria-labelledby="ID_REFERENCE"
+ div
Refers to the element that contains the label of the radio group.
+
+
+
+ radio
+
+ g
Identifies the
+ g
element as an ARIA radio
button.
+
+
+
+ aria-label="name"
+ g
Defines an accessible name that identifies the number of stars associated with the radio button (e.g. "one star", two stars", ..).
+
+
+
+
+ tabindex="-1"
+ g
+
+
+
+
+
+
+
+ tabindex="0"
+ g
+
+
+
+
+
+
+
+ aria-checked="false"
+ g
+
+
+
+ radio
buttons which are not checked.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo-element is used to indicate visual state of unchecked radio buttons to support high contrast settings in operating systems and browsers.
+
+
+
+
+ aria-checked="true"
+ g
+
+
+
+ radio
button which is checked.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo-element is used to indicate visual state of checked radio buttons to support high contrast settings in operating systems and browsers.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Radio Group Example Using Roving tabindex
-
-
+
+ aria-activedescendant
for managing keyboard focus.About This Example
+
+
+ aria-activedescendant
for managing keyboard focus.Example
Pizza Crust
- Pizza Delivery
- Pizza Delivery
Accessibility Features
aria-checked
state with the visual state indicator.:hover
and :focus
pseudo-classes for styling visual keyboard focus and hover.
+ :hover
and :focus
pseudo-classes for styling visual keyboard focus and hover.
Accessibility Features
When focusable elements are not focused, they have a 0-width border and additional padding equal in width to the border that is used to indicate focus.
forced-color-adjust
is set to auto
on the svg
graphics.
+ To ensure the inline SVG radio button graphics in the CSS file have sufficient contrast with the background when high contrast settings change the color of text content, CSS forced-color-adjust
is set to auto
on the svg
graphics.
This causes the colors of the stroke
and fill
of the circle elements to be overridden by the high contrast color setting.
To make the background of the circle
elements match the high contrast background color, the fill-opacity
attribute of the outer circle
is set to zero and the stroke-opacity
attribute of the inner circle
is set to zero.
If forced-color-adjust
were not used to override the colors specified for the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the radio circle elements and the background or even make them invisible if their color matched the high contrast mode background.
@@ -154,8 +145,8 @@ Keyboard Support
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
@@ -202,7 +193,10 @@
@@ -216,7 +210,10 @@ Role, Property, State, and Tabindex Attributes
Role, Property, State, and Tabindex Attributes
HTML Source Code
-
diff --git a/content/patterns/radio/radio-group-pattern.html b/content/patterns/radio/radio-group-pattern.html
new file mode 100644
index 0000000000..04f0f89be2
--- /dev/null
+++ b/content/patterns/radio/radio-group-pattern.html
@@ -0,0 +1,135 @@
+
+
+
+
+
+ Radio Group Pattern
+
+ About This Pattern
+ Examples
+
+
+ Keyboard Interaction
+ For Radio Groups Not Contained in a Toolbar
+
+
+
+
+ Note
+ For Radio Group Contained in a Toolbar
+
+
+
+
+
+
+ Note
+ WAI-ARIA Roles, States, and Properties
+
+
+ radio
element has aria-checked set to true
.
+ If it is not checked, it has aria-checked set to false
.
+ radio
element is labelled by its content, has a visible label referenced by aria-labelledby, or has a label specified with aria-label.radiogroup
element has a visible label referenced by aria-labelledby or has a label specified with aria-label.radiogroup
element or radio
elements with the aria-describedby property.Horizontal Multi-Thumb Slider Example
- About This Example
+ Warning!
+
-
+ aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.
+
+
aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
Hotel Price Range (in USD)
+ Accessibility Features
currentcolor
value for the stroke
property of the inline SVG rect
element used to draw the focus ring border.
- To make the background of the rect
match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
- If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- currentcolor
value for the stroke
property of the inline SVG rect
element used to draw the focus ring border.
+ To make the background of the rect
match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
+ If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
+ Some browsers do not use auto
for the default value.
+
@@ -134,11 +126,17 @@ Keyboard Support
Page Up
- Increases slider value multiple steps. In this slider, jumps ten steps.
+
+ Increases slider value multiple steps.
+ In this slider, jumps ten steps.
+
Page Down
- Decreases slider value multiple steps. In this slider, jumps ten steps.
+
+ Decreases slider value multiple steps.
+ In this slider, jumps ten steps.
+
Home
@@ -151,6 +149,7 @@ Keyboard Support
Role, Property, State, and Tabindex Attributes
@@ -163,17 +162,15 @@
Role, Property, State, and Tabindex Attributes
-
-
-
- none
-
-
-
- svg
-
- The use of the
+ none
role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
-
+
+
+ none
+
+
+
+ svg
+ The use of the
none
role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
@@ -265,16 +262,13 @@ Javascript and CSS Source Code
HTML Source Code
-
-
-
-
+
+
+
-
diff --git a/content/patterns/slider-multithumb/slider-multithumb-pattern.html b/content/patterns/slider-multithumb/slider-multithumb-pattern.html
new file mode 100644
index 0000000000..7e579c8c78
--- /dev/null
+++ b/content/patterns/slider-multithumb/slider-multithumb-pattern.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+ Slider (Multi-Thumb) Pattern
+
+ About This Pattern
+ Warning
+ Example
+ Keyboard Interaction
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+ aria-valuenow
is not user-friendly, e.g., the day of the week is represented by a number, the aria-valuetext property is set to a string that makes the slider value understandable, e.g., "Monday".
+ vertical
.
+ The default value of aria-orientation
for a slider is horizontal
.
+ Color Viewer Slider Example
+
+ About This Example
+ Warning!
+
+
+ aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
+ Accessibility Features
+
+
+ group
labeled by the heading that labels the color viewer.currentcolor
value for the stroke
property is used for the SVG rect
elements to synchronize the border color with text content.
+ If specific colors were used to specify the stroke
property, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background.
+ NOTE: The SVG elements need to be inline to use currentcolor
.
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Right Arrow
+ Increases slider value one step.
+
+
+ Up Arrow
+ Increases slider value one step.
+
+
+ Left Arrow
+ Decreases slider value one step.
+
+
+ Down Arrow
+ Decreases slider value one step.
+
+
+ Page Up
+
+ Increases slider value multiple steps.
+ In this slider, jumps ten steps.
+
+
+
+ Page Down
+
+ Decreases slider value multiple steps.
+ In this slider, jumps ten steps.
+
+
+
+ Home
+ Sets slider to its minimum value.
+
+
+
+ End
+ Sets slider to its maximum value.
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ group
+
+ div
+
+
+
+ div
as a group.
+
+
+
+ aria-labelledby="IDREF"
+ div
Refers to the heading element that provides the accessible name for the group.
+
+
+
+
+ slider
+
+
+
+ div
+
+
+
+
+ div
that represents the movable thumb because it is the operable element that controls the slider value.
+
+
+
+
+ tabindex="0"
+
+
+ div
+ Includes the slider thumb in the page tab sequence.
+
+
+
+
+
+ aria-valuemax="255"
+
+
+ div
+ Specifies the maximum value of the slider.
+
+
+
+
+
+ aria-valuemin="0"
+
+
+ div
+ Specifies the minimum value of the slider.
+
+
+
+
+
+ aria-valuenow="NUMBER"
+
+
+ div
+ Indicates the current value of the slider.
+
+
+
+
+
+ aria-labelledby="IDREF"
+
+
+ div
+ Refers to the element containing the name of the slider.
+
+
+
+
+
+ aria-hidden="true"
+ svg
+ Removes the SVG elements from the accessibility tree.
+ Some assistive technologies will describe the SVG elements, unless they are explicitly hidden.
+
+ Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Rating Slider Example
+
+ About This Example
+ Warning!
+
+
+ aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
+ Accessibility Features
+
+
+ aria-valuetext
property to communicate both the current and maximum values.
+ However, since repeating the maximum value every time the slider value changes is potentially distracting, the maximum value is included in aria-valuetext
only when the slider is initialized and when the thumb loses keyboard focus.
+ currentcolor
value for the stroke
property of each inline SVG polygon
element.
+ To enable the high contrast background color to be the used as the contrasting color when a star is not fully or partially filled, the fill-opacity
attribute of the polygon
is set to zero.
+ If specific colors were used to specify the stroke
and fill
properties, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust
property set to the value auto
for the currentcolor
value to be updated in high contrast modes.
+ Some browsers do not use auto
for the default value.Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Right Arrow
+ Increases slider one half star.
+
+
+ Up Arrow
+ Increases slider one half star.
+
+
+ Left Arrow
+ Decreases slider one half star.
+
+
+ Down Arrow
+ Decreases slider one half star.
+
+
+ Page Up
+
+ Increases slider value multiple steps.
+ In this slider, jumps one star.
+
+
+
+ Page Down
+
+ Decreases slider value multiple steps.
+ In this slider, jumps one star.
+
+
+
+ Home
+ Sets slider to its minimum value, no stars.
+
+
+
+ End
+ Sets slider to its maximum value, five stars.
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ slider
+
+
+
+ div
+
+
+
+
+ div
that represents the movable thumb because it is the operable element that controls the slider value.
+
+
+
+
+ tabindex="0"
+
+
+ div
+ Includes the slider thumb in the page tab sequence.
+
+
+
+
+
+ aria-valuemax="5"
+
+
+ div
+ Specifies the maximum value of the slider.
+
+
+
+
+
+ aria-valuemin="0"
+
+
+ div
+ Specifies the minimum value of the slider.
+
+
+
+
+
+ aria-valuenow="NUMBER"
+
+
+ div
+ Indicates the current value of the slider.
+
+
+
+
+
+ aria-valuetext="STRING"
+
+
+ div
+
+
+
+
+ 3 of 5 stars
.
+
+
+
+
+ aria-labelledby="IDREF"
+
+
+ div
+ Refers to the element containing the name of the slider.
+
+
+
+
+
+ aria-hidden="true"
+ svg
Removes the SVG elements from the accessibility tree to prevent assistive technologies from presenting them as elements separate from the slider.
+ Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Media Seek Slider Example
+
+ About This Example
+ Warning!
+ aria-valuetext
to provide assistive technology users with meaningful names for numeric values.
+ In this case, the value of the control is the position in seconds.
+ For example, if the play position were 4 minutes and 3 seconds from the start, the slider value is 243.
+ If aria-valuetext
were not used, assistive technology users would be told that the position is 243
, which is significantly more difficult to comprehend than 4 minutes, 3 seconds
.
+ So, the code converts the slider value to a string that communicates the position in minutes and seconds and provides that value via aria-valuetext
.
+
+
+ aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
+ Accessibility Features
+
+
+ aria-valuetext
property to communicate both the current and maximum values.
+ However, since repeating the maximum value every time the slider value changes is potentially distracting, the maximum value is included in aria-valuetext
only when the slider is initialized and when the thumb loses keyboard focus.
+ currentcolor
value for the stroke
property of the inline SVG rect
element used to draw the focus ring border.
+ To make the background of the rect
match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
+ If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
+ Some browsers do not use auto
for the default value.
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Right Arrow
+
+ Increases slider value one step.
+
+
+
+ Up Arrow
+
+ Increases slider value one step.
+
+
+
+ Left Arrow
+
+ Decreases slider value one step.
+
+
+
+ Down Arrow
+
+ Decreases slider value one step.
+
+
+
+ Page Up
+
+ Increases slider value 15 steps.
+
+
+
+ Page Down
+
+ Decreases slider value 15 steps.
+
+
+
+ Home
+
+ Sets slider to its minimum value.
+
+
+
+
+ End
+
+ Sets slider to its maximum value.
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ none
+
+
+
+ svg
+ The use of the
+ none
role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
+
+
+
+ slider
+
+
+
+ g
+
+
+
+
+ g
element that represents as the movable thumb because it is the operable element that represents the slider value.
+
+
+
+
+ tabindex="0"
+
+
+ g
+ Includes the slider thumb in the page tab sequence.
+
+
+
+
+
+ aria-valuemax="NUMBER"
+
+
+ g
+ Specifies a numeric value that is the maximum value the slider can have.
+
+
+
+
+
+ aria-valuemin="NUMBER"
+
+
+ g
+ Specifies a numeric value that is the minimum value the slider can have.
+
+
+
+
+
+ aria-valuenow="NUMBER"
+
+
+ g
+ A numeric value that is the current value of the slider.
+
+
+
+
+
+ aria-valuetext="STRING"
+
+
+ g
+
+
+
+
+
+
+
+
+
+ aria-labelledby="IDREF"
+
+
+ g
+ Refers to the element containing the name (e.g. label) of the slider.
+
+
+
+
+
+
+ aria-hidden="true"
+
+
+ rect
+ Removes the SVG
+ rect
element from the accessibility tree to prevent assistive technologies from presenting it as an image separate from the slider.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Vertical Temperature Slider Example
+
+ About This Example
+ Warning!
+ aria-orientation
to specify vertical orientation and use of aria-valuetext
to convey unit of measure for numeric values to assistive technology users by appending degrees Celsius
to the current value.
+
+
+ aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
+ Accessibility Features
+
+
+ currentcolor
value for the stroke
property of the inline SVG rect
element used to draw the focus ring border.
+ To make the background of the rect
match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
+ If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
+ Some browsers do not use auto
for the default value.
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Right Arrow
+
+ Increases slider value one step.
+
+
+
+ Up Arrow
+
+ Increases slider value one step.
+
+
+
+ Left Arrow
+
+ Decreases slider value one step.
+
+
+
+ Down Arrow
+
+ Decreases slider value one step.
+
+
+
+ Page Up
+
+
+ Increases temperature slider value multiple steps.
+ In this slider, jumps twenty steps (e.g. 2°C).
+
+
+
+
+ Page Down
+
+
+ Decreases temperature slider value multiple steps.
+ In this slider, jumps twenty steps (e.g. 2°C).
+
+
+
+
+ Home
+
+ Sets slider to its minimum value.
+
+
+
+
+ End
+
+ Sets slider to its maximum value.
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ none
+
+
+
+ svg
+ ensures assistive technologies do not present the SVG element as an image or any other type of meaningful element.
+
+
+
+
+ slider
+
+
+
+ g
+
+
+
+
+ g
element that represents the movable thumb because it is the operable element that receives focus and conveys the value.
+
+
+
+
+ tabindex="0"
+
+
+ g
+ Includes the slider thumb in the page tab sequence.
+
+
+
+
+
+ aria-orientation
+
+
+ g
+ Indicates the slider is vertically oriented.
+
+
+
+
+
+ aria-valuemax="NUMBER"
+
+
+ g
+ Specifies the numeric value that is the maximum allowed value of the slider.
+
+
+
+
+
+ aria-valuemin="NUMBER"
+
+
+ g
+ Specifies the numeric value that is the minimum allowed value of the slider.
+
+
+
+
+
+ aria-valuenow="NUMBER"
+
+
+ g
+ A numeric value that is the current value of the slider.
+
+
+
+
+
+ aria-valuetext="STRING"
+
+
+ g
+ Provides a more user-friendly name for the current value of the slider by combining the current value with the string
+ degrees Celsius
.
+
+
+
+
+ aria-labelledby="IDREF"
+
+
+ g
+ Refers to the element containing the name (e.g. label) of the slider.
+
+
+
+
+
+
+ aria-hidden="true"
+
+
+ rect
+ Removes the SVG
+ rect
element from the accessibility tree to prevent screen readers from presenting it as a meaningful image.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Slider Pattern
+
+ About This Pattern
+ Warning
+ Examples
+
+
+ aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Keyboard Interaction
+
+
+ Note
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+ aria-valuenow
is not user-friendly, e.g., the day of the week is represented by a number, the aria-valuetext property is set to a string that makes the slider value understandable, e.g., "Monday".vertical
.
+ The default value of aria-orientation
for a slider is horizontal
.
+ Date Picker Spin Button Example
+
+ About This Example
+
+
+ Example
+ Accessibility Features
+
+
+ div
that contains a date string that reflects the current values of the three spin buttons.
+ This enables screen reader users to easily perceive the date represented by the three buttons without having to navigate to all three buttons and remember the value of each one; it is the screen reader user equivalent to seeing the date at a glance.
+ aria-valuetext
to properly pronounce the day, e.g. first, second, third ...aria-valuetext
to properly pronounce the month instead of the numeric value, e.g. January, February, ...div
with role spinbutton
so they can be separately focusable by users of touch screen readers.
+ However, they are excluded from the page Tab sequence with tabindex="-1"
because they are redundant with the arrow key support provided to keyboard users.
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Down Arrow
+
+
+
+
+ Day
spin button and the value is the first day of the month, changes value to the last day of the month.Month
spin button and the value is January
, changes value to December
.
+
+ Up Arrow
+
+
+
+
+ Day
spin button and the value is the last day of the month, changes value to the first day of the month.Month
spin button and the value is December
, changes value to January
.
+
+ Page Down
+
+
+
+
+ Day
spin button and the value is the fifth day of the month or less, changes value to the last day of the month.Month
spin button and the value is the fifth month of the year or less, changes value to December
.
+
+ Page Up
+
+
+
+
+ Day
spin button and the value is any of the last five days of the month, changes value to the first day of the month.Month
spin button and the value is any of the last five months of the year, changes value to January
.
+
+ Home
+ Decreases to minimum value.
+
+
+
+ End
+ Increases to maximum value.
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ group
+
+ div
+
+
+
+ div
as a group.
+
+
+
+ aria-labelledby="IDREFs"
+ div
+
+
+
+ div
elements that provide the accessible name for the group.Choose a Date
.div
that contains a string specifying the current date represented by the values of the three spin buttons, which is updated by JavaScript as users change the values of the spin buttons.
+
+
+ spinbutton
+
+ div
Identifies the
+ div
element as a spinbutton
.
+
+
+
+ aria-label="NAME_STRING"
+ div
Defines the accessible name for each spin button (e.g.
+ day
, month
and year
).
+
+
+
+ aria-valuenow="NUMBER"
+ div
+
+
+
+
+
+
+
+
+ aria-valuetext="DAY_NUMBER_STRING"
or
+ aria-valuetext="MONTH_STRING"
+
+ div
+
+
+
+ Day
spin button, provides screen reader users with a friendlier pronunciation of the number of the day of the month (i.e. first
instead of one
).Month
spin button, provides screen reader users with a friendlier announcement of the month (i.e., January
instead of one
).
+
+
+
+ aria-valuemin="NUMBER"
+ div
Indicates the minimum allowed value for the spin button.
+
+
+
+
+ aria-valuemax="NUMBER"
+ div
+
+
+
+ Day
spin button, this property is updated based on the value of the Month
spin button.
+
+
+
+ aria-hidden="true"
+
+
+
+ div.next
div.previous
For assistive technology users, hides the text showing the next and previous values that is displayed adjacent to the up and down arrow icons since it would otherwise add superfluous elements to the screen reader reading order that are likely to be more confusing than helpful.
+
+
+
+
+ aria-label="NAME_STRING"
+ button
Defines the accessible name for each increase and decrease button (
+ Next Day
, Previous Day
, Next Month
, Previous Month
, Next year
, and Previous Year
).
+
+
+
+
+ tabindex="-1"
+ button
Removes the decrease and increase buttons from the page Tab sequence while keeping them focusable so they can be accessed with touch-based assistive technologies.
+ Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Spinbutton Pattern
+
+ About This Pattern
+ Example
+ Keyboard Interaction
+
+
+
+
+ Note
+
+
+
+
+ contenteditable
HTML attribute.WAI-ARIA Roles, States, and Properties
+
+
+ aria-valuenow
is not user-friendly, e.g., the day of the week is represented by a number, the aria-valuetext property is set on the spinbutton element to a string that makes the spinbutton value understandable, e.g., "Monday".
+ true
if the value is outside the allowed range.
+ Note that most implementations prevent input of invalid values, but in some scenarios, blocking all invalid input may not be practical.
+ Switch Example Using HTML Button
+
+ About This Example
+ button
as a switch element and using an SVG
element to provide graphical rendering of switch states.
+ It also demonstrates using the group
role to present multiple switches in a labeled group.
+
+
+ div
element that turns a notification preference on and off.input[type="checkbox"]
elements that turn accessibility preferences on and off.Example
+ Environmental Controls
+ Accessibility Features
+
+
+ Environmental Controls
are a group of two switches, the switches are wrapped in a group
labeled by the heading that labels the set of switches.on
or off
) is displayed adjacent to the graphical state indicator.
+ CSS attribute selectors ensure the label displayed is synchronized with the value of the aria-checked
attribute.
+ NOTE: To prevent redundant announcement of the state by screen readers, the text indicators of state are hidden from assistive technologies with aria-hidden
.
+
+
+ :hover
and :focus
pseudo-classes:
+
+
+ currentcolor
value for the stroke
and fill
properties is used to synchronize the colors with text content.
+ If specific colors were used to specify the stroke
and fill
properties, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background.
+ The fill-opacity
of the container rect
is set to zero for the background color of the page to provide the contrasting color to the stroke
and fill
colors.
+ NOTE: The SVG elements need to set the CSS forced-color-adjust
property to auto
for some browsers to support the currentcolor
value.
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Tab
+
+
+
+
+ switch
.
+
+
+ Space, Enter
+
+
+
+
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ switch
+
+ button
Identifies the
+ button
element as a switch
.
+
+
+
+ aria-checked="false"
+ button
+
+
+
+ switch
is off.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
+
+
+
+ aria-checked="true"
+ button
+
+
+
+ switch
is on.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
+
+
+
+ aria-hidden="true"
+ span.on
and span.off
+
+
+
+ on
and off
that appear to the right of the switch from the accessible name of the switch.
+
+
+
+
+ h3
Provides a grouping label for the group of switches.
+
+
+
+ group
+
+ div
Identifies the
+ div
element as a group
container for the switches.
+
+
+
+
+ aria-labelledby
+ div
References the
+ h3
element to define the accessible name for the group of switches.Javascript and CSS Source Code
+
+
+
+ HTML Source Code
+
+
+
+
+ Switch Example Using HTML Checkbox Input
+
+ About This Example
+ input[type="checkbox"]
as the switch element and using CSS borders to provide graphical rendering of switch states.
+ It also demonstrates using the HTML fieldset
and legend
elements to present multiple switches in a labeled group.
+
+
+ div
element that turns a notification preference on and off.button
elements that turn lights on and off.Example
+ Accessibility Features
+
+
+ Accessibility Preferences
, the switches are wrapped in a fieldset
element labeled with a legend
element.on
or off
) is displayed adjacent to the graphical state indicator.
+ CSS attribute selectors ensure the label displayed is synchronized with the value of the input
.
+ NOTE: To prevent redundant announcement of the state by screen readers, the text indicators of state are hidden from assistive technologies with aria-hidden
.
+
+
+ :hover
pseudo-class and onfocus
and onblur
event handlers:
+
+
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Tab
+ Moves keyboard focus to the
+ switch
.
+
+
+ Space
+ Toggles the state of the switch between on and off.
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ switch
+
+ input[type="checkbox"]
+
+
+
+ switch
.label
element.
+
+
+
+
+ aria-hidden="true"
+ span.on
and span.off
+
+
+
+ on
and off
that appear to the right of the switch from the accessible name of the switch.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Switch Example
+
+ About This Example
+ div
element for the switch and CSS borders to provide graphical rendering of switch states.
+
+
+ button
elements that turn lights on and off.input[type="checkbox"]
elements that turn accessibility preferences on and off.Example
+ Accessibility Features
+
+
+ on
or off
) is displayed adjacent to the graphical state indicator.
+ CSS attribute selectors ensure the label displayed is synchronized with the value of the aria-checked
attribute.
+ NOTE: To prevent redundant announcement of the state by screen readers, the text indicators of state are hidden from assistive technologies with aria-hidden
.
+
+
+ :hover
and :focus
pseudo-classes:
+
+
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Tab
+
+
+
+
+ switch
.
+
+
+ Space
+
Enter
+
+
+
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ switch
+
+ div
Identifies the
+ div
element as a switch
.
+
+
+
+ tabindex="0"
+ div
Includes the switch in the page Tab sequence.
+
+
+
+
+ aria-checked="false"
+ div
+
+
+
+ switch
is off.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
+
+
+
+ aria-checked="true"
+ div
+
+
+
+ switch
is on.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
+
+
+
+
+ aria-hidden="true"
+ span.on
and span.off
+
+
+
+ on
and off
that appear to the right of the switch from the accessible name of the switch.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Switch Pattern
+
+ About This Pattern
+ on
or off
.
+ Switches are similar to checkboxes and toggle buttons, which can also serve as binary inputs.
+ One difference, however, is that switches can only be used for binary input while checkboxes and toggle buttons allow implementations the option of supporting a third middle state.
+ Checkboxes can be checked
or not checked
and can optionally also allow for a partially checked
state.
+ Toggle buttons can be pressed
or not pressed
and can optionally allow for a partially pressed
state.
+ on or off
would be easier for assistive technology users to understand than the semantics of checked or unchecked
, and vice versa.
+ Consider a widget for turning lights on or off.
+ In this case, screen reader output of Lights switch on
is more user friendly than Lights checkbox checked
.
+ However, if the same input were in a group of inputs labeled Which of the following must be included in your pre-takeoff procedures?
, Lights checkbox checked
would make more sense.
+ Examples
+
+
+ div
element that turns a notification preference on and off.button
elements that turn lights on and off.input[type="checkbox"]
elements that turn accessibility preferences on and off.Keyboard Interaction
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+
+
+ switch
.switch
.switch
.on
, the switch element has state aria-checked set to true
.off
, the switch element has state aria-checked set to false
.input[type="checkbox"]
, it uses the HTML checked
attribute instead of the aria-checked
property.
+
+ fieldset
and the label for the set is contained in an HTML legend
element.Sortable Table Example
+
+ About This Example
+ aria-sort
attribute is set on the column header of the currently sorted column, and the header text of sortable columns is wrapped in a button
element.
+ One column, the Address
column is not sortable.
+
+
+ div
and span
elements.Example Option
+
+ ♢
) to the header of each column that can be sorted but is not currently sorted.
+ Some sortable tables add an icon to unsorted columns to help users distinguish sortable columns from columns that cannot be sorted.
+ It is important that the shape of the unsorted icon differ in more than just color and size from the icons that indicate sort direction (e.g. '▼' and '▲') so people with visual impairments can easily distinguish them.
+ Example
+
+
+
+
+
+
+
+
+
+
+
+
+ Address
+
+
+
+
+ Fred
+ Jackson
+ Canary, Inc.
+ 123 Broad St.
+ 56
+
+
+ Sara
+ James
+ Cardinal, Inc.
+ 457 First St.
+ 7
+
+
+ Ralph
+ Jefferson
+ Robin, Inc.
+ 456 Main St.
+ 513
+
+
+
+ Nancy
+ Jensen
+ Eagle, Inc.
+ 2203 Logan Dr.
+ 3.5
+ Accessibility Features
+
+
+ :hover
and :focus
pseudo-classes:
+
+
+ Keyboard Support
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ aria-sort="value"
+ th
+
+
+
+ aria-sort
attribute is removed and set on the newly sorted column.
+ ascending
" indicates the data cells in the column are sorted in ascending order.descending
" indicates the data cells in the column are sorted in descending order.
+
+
+
+
+ aria-hidden="true"
+ span
Removes the character entities used for sort icons from the accessibility tree to prevent them from being included in the accessible name of the sort buttons.
+ Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Table Example
+
+ About This Example
+ table
element is recommended.
+
+
+ aria-sort
in the headers of sortable columns.Example
+ Keyboard Support
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ table
+
+ div
Identifies the element containing the table structure.
+
+
+
+
+
+ aria-label="Students"
+
+ div
Provides an accessible name for the table.
+
+
+
+
+
+ aria-describedby="IDREF"
+
+ div
Refers to the element that serves as the caption for the table.
+
+
+
+ rowgroup
+
+ div
+
+
+
+
+
+
+ row
+
+ div
Identifies each element that contains the cells for a row.
+
+
+
+ columnheader
+
+ span
Identifies elements that serve as a cell containing a column label.
+
+
+
+
+ cell
+
+ span
Identifies elements containing content for a single cell.
+ Javascript and CSS Source Code
+
+
+
+ HTML Source Code
+
+
+
+
+ Table Pattern
+
+ About This Pattern
+ table
element, a WAI-ARIA table is a static tabular structure containing one or more rows that each contain one or more cells; it is not an interactive widget.
+ Thus, its cells are not focusable or selectable.
+ The grid pattern is used to make an interactive widget that has a tabular structure.
+ Note
+ table
element whenever possible.
+ This is especially important with role table
because it is a new feature of WAI-ARIA 1.1.
+ It is thus advisable to test implementations thoroughly with each browser and assistive technology combination that could be used by the target audience.Examples
+
+
+ div
and span
elements.aria-sort
in the headers of sortable columns.Keyboard Interaction
+ WAI-ARIA Roles, States, and Properties
+
+
+ table
element or an element with role rowgroup.row
element and has one of the following roles:
+
+
+
+
+ Note
+ table
element unless the DOM descendants are also included in the aria-owns
attribute.Example of Tabs with Automatic Activation
- About This Example
+
-
+ For additional guidance, see Deciding When to Make Selection Automatically Follow Focus.
+
+
+
Example
Danish Composers
- Accessibility Features
tabpanel
, the tabpanel
element has tabindex="0"
to include the panel in the page Tab sequence.
- It is recommended that all tabpanel
elements in a tab set are focusable if there are any panels in the set that contain content where the first element in the panel is not focusable.
+ It is recommended that all tabpanel
elements in a tab set are focusable if there are any panels in the set that contain content where the first element in the panel is not focusable.
Keyboard Support
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
@@ -274,10 +250,7 @@
@@ -307,9 +283,7 @@ Role, Property, State, and Tabindex Attributes
@@ -295,7 +268,10 @@
-
Role, Property, State, and Tabindex Attributes
button
element is used for the tab, it is not necessary to set tabindex="0"
on the selected (active) tab element.Role, Property, State, and Tabindex Attributes
- button
- Refers to the element with
+ role=tabpanel
associated with the tab.
- Refers to the element with
role=tabpanel
associated with the tab.
@@ -381,12 +353,6 @@
@@ -322,9 +296,7 @@ Role, Property, State, and Tabindex Attributes
tab
control is activated.
- tab
control is activated.HTML Source Code
sourceCode.make();
-
-
-
diff --git a/examples/tabs/tabs-manual.html b/content/patterns/tabs/examples/tabs-manual.html
similarity index 64%
rename from examples/tabs/tabs-manual.html
rename to content/patterns/tabs/examples/tabs-manual.html
index 7f24f3b185..04f5e3003a 100644
--- a/examples/tabs/tabs-manual.html
+++ b/content/patterns/tabs/examples/tabs-manual.html
@@ -2,44 +2,46 @@
- Example of Tabs with Manual Activation
- About This Example
+
-
+ For additional guidance, see Deciding When to Make Selection Automatically Follow Focus.
+
+
+
Example
Danish Composers
- Danish Composers
Accessibility Features
-
Accessibility Features
tabpanel
is a focusable element (i.e., a link), the tabpanel
is not included in the page Tab sequence.
- To make it easy for screen reader users to navigate from a tab to the beginning of content in the active tabpanel
, it is recommended that all tabpanel
elements in a tab set are focusable if there are any panels in the set that contain content where the first element in the panel is not focusable.
- tabpanel
, it is recommended that all tabpanel
elements in a tab set are focusable if there are any panels in the set that contain content where the first element in the panel is not focusable.Keyboard Support
Tab
-
tab
element .tab
element.a
element in tabpanel
.
Enter
-
Space
- When a tab has focus, activates the tab, causing its associated panel to be displayed.
-
+ When a tab has focus, activates the tab, causing its associated panel to be displayed.
Right Arrow
@@ -207,7 +187,7 @@ Keyboard Support
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
@@ -249,9 +229,7 @@
@@ -281,10 +259,7 @@ Role, Property, State, and Tabindex Attributes
tabpanel
.
- tabpanel
.Role, Property, State, and Tabindex Attributes
@@ -302,7 +277,10 @@
-
Role, Property, State, and Tabindex Attributes
button
element is used for the tab, it is not necessary to set tabindex="0"
on the selected (active) tab element.Role, Property, State, and Tabindex Attributes
- button
- Refers to the
+ tabpanel
element associated with the tab.
- Refers to the
tabpanel
element associated with the tab.
@@ -345,9 +319,7 @@
@@ -329,9 +305,7 @@ Role, Property, State, and Tabindex Attributes
tab
control is activated.
- tab
control is activated.Role, Property, State, and Tabindex Attributes
@@ -374,11 +346,6 @@
-
tab
element that controls the panel.
- tab
element that controls the panel.HTML Source Code
sourceCode.make();
-
-
-
diff --git a/content/patterns/tabs/tabs-pattern.html b/content/patterns/tabs/tabs-pattern.html
new file mode 100644
index 0000000000..d77bd8168d
--- /dev/null
+++ b/content/patterns/tabs/tabs-pattern.html
@@ -0,0 +1,141 @@
+
+
+
+
+
+ Tabs Pattern
+
+ About This Pattern
+
+
+ Examples
+
+
+ Keyboard Interaction
+
+
+
+
+ tab
element.
+
+
+
+ Note
+
+
+ vertical
:
+
+
+ tabindex="0"
to include it in the tab sequence of the page.WAI-ARIA Roles, States, and Properties
+
+
+ tablist
.tab
has role tabpanel.tablist
has aria-labelledby set to a value that refers to the labelling element.
+ Otherwise, the tablist
element has a label provided by aria-label.
+ tab
has the property aria-controls referring to its associated tabpanel
element.tab
element has the state aria-selected set to true
and all other tab
elements have it set to false
.tabpanel
has the property aria-labelledby referring to its associated tab
element.tab
element has a popup menu, it has the property aria-haspopup set to either menu
or true
.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
.Toolbar Help
+
+ About This Example
+ Toolbar Example
+
+ About This Example
+ Example
+
+
+ Accessibility Features
+ Keyboard Features
+
+
+
+
+ Focus Styling
+
+
+ Button Popup Labels
+
+
+ Keyboard Support
+ Toolbar
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Tab
+
+
+
+
+
+
+ Right Arrow
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+ Home
+ Moves focus to the first control.
+
+
+ End
+ Moves focus to the last control.
+
+
+
+ ESC
+ If a button popup label is visible, hides it.
+ Toggle Buttons (Bold, Italic, Underline)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Enter
+
SpaceToggle the pressed state of the button.
+ Radio Group (Text Alignment)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Enter
+
Space
+
+
+
+
+
+ Down Arrow
+
+
+
+
+
+
+
+ Up Arrow
+
+
+
+
+ Button (Cut, Copy, Paste)
+ aria-disabled
instead of the HTML disabled
attribute.
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Enter
+
Space
+ If the button is enabled, execute the action associated with the button.
+ Otherwise, do nothing.
+
+ Menu Button (Font Family)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+
+ Enter
+
+ Space
+ Down Arrow
+ Up Arrow
+
+ Open the menu and place focus on a menu item.
+ In this implementation, the focus is set on the currently selected font family when the menu opens.
+
+ Menu (Font Family)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Enter
+
SpaceActivate the menu item, close the menu, and place focus on the menu button.
+
+
+ Down Arrow
+
+
+
+
+
+
+ Up Arrow
+
+
+
+
+
+
+
+ ESC
+ Closes the menu and moves focus to the menu button.
+ Spin Button (Font Size)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Down Arrow
+ Decreases the font size of the text in the
+ textarea
by 1 point.
+
+ Up Arrow
+ Increases the font size of the text in the
+ textarea
by 1 point.
+
+ Page Down
+ Decreases the font size of the text in the
+ textarea
by 5 points.
+
+
+ Page Up
+ Increases the font size of the text in the
+ textarea
by 5 points.Checkbox (Night Mode)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Space
+ Toggles the state of the checkbox.
+ Link (Help)
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Enter
+
SpaceActivate the link.
+ Role, Property, State, and Tabindex Attributes
+ Toolbar
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ toolbar
+
+ div
+
+
+
+ toolbar
.
+
+
+
+
+ aria-label="Text Formatting"
+
+ div
Provides the toolbar with an accessible name of "Text Formatting".
+
+
+
+
+
+ aria-controls="IDREF"
+
+ div
Set to a value that references the text area, indicating the toolbar controls the text area.
+
+
+
+
+
+ tabindex="-1"
+
+ button
, div
, input[type="checkbox"]
, a
+
+
+
+
+
+
+
+
+
+ tabindex="0"
+
+ button
, div
, input[type="checkbox"]
, a
+
+
+
+ Toggle Buttons (Bold, Italic, Underline)
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ aria-pressed="true"
+ button
Indicates the button is a toggle and that the styling controlled by the button has been applied.
+
+
+
+
+
+ aria-pressed=
+ false
+ button
Indicates the button is a toggle and that the styling controlled by the button has NOT been applied.
+
+
+
+
+
+ aria-hidden="true"
+ span
Hides the icon character from being included in the accessible name.
+ Radio Group (Text Alignment)
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ radiogroup
+
+ div
Identifies the
+ div
element as a container for group of radio buttons.
+
+
+
+ aria-label="Text Alignment"
+ div
Defines the accessible name for the group of radio buttons as "Text Alignment".
+
+
+
+ radio
+
+ button
+
+
+
+ button
element as a radio
button.button
element.
+
+
+
+ aria-checked="true"
+ button
+
+
+
+ aria-checked
set to true
at any given time.
+
+
+
+ aria-checked="false"
+ button
+
+
+
+ aria-checked
set to false
.
+
+
+
+
+ aria-hidden="true"
+ span
Hides the icon character from being included in the accessible name.
+ Button (Cut, Copy, Paste)
+ aria-disabled
instead of the HTML disabled
attribute.
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ aria-disabled="true"
+ button
Set when the button is disable to inform assistive technologies of the disabled state.
+
+
+
+
+
+ aria-disabled="false"
+ button
Set when the function provided by the button is available.
+ Menu Button (Font Family)
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ aria-label="Font: FONT_FAMILY_NAME"
+ button
+
+
+
+ Font:
with the name of the font family currently checked in the menu.
+
+
+
+ aria-haspopup="true"
+ button
+
+
+
+ button
opens a menu.menubutton
, most platform accessibility APIs have a menubutton
role.
+ On those platforms, assistive technologies identify buttons with aria-haspopup
set to either true
or menu
as menu buttons.
+
+
+
+
+ aria-controls="IDREF"
+ button
+
+
+
+ menu
.
+
+
+
+
+ aria-expanded="true"
+ button
+
+
+
+ aria-expanded
attribute is removed when the menu is closed.Menu (Font Family)
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+
+ menu
+
+
+ ul
Identifies the
+ ul
element as a menu
.
+
+
+
+ aria-label="Font Family"
+ ul
Defines the accessible name for the menu as "Font Family".
+
+
+
+ menuitemradio
+
+ li
+
+
+
+ li
element as a menuitemradio
.li
element provides the accessible name of the menuitemradio
.
+
+
+
+ aria-checked="true"
+ li
+
+
+
+ menuitemradio
to indicate the item is checked, informing users which font is applied to the text area.
+
+
+
+ aria-checked="false"
+ li
+
+
+
+ menuitemradio
to indicate the items are NOT checked.
+
+
+
+
+ tabindex="-1"
+
+ li
+
+
+
+
+ menuitemradio
element focusable so DOM focus can be set on the menu item.Spin Button (Font Size)
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ spinbutton
+
+ div
Identifies the
+ div
element as a spinbutton
.
+
+
+
+ aria-label="Font size in points"
+ div
Defines the accessible name for the spin button as "Font size in points".
+
+
+
+
+ aria-valuenow="NUMBER_POINTS"
+ div
+
+
+
+
+
+
+
+ aria-valuetext="NUMBER_POINTS Points"
+ div
+
+
+
+ NUMBER_POINTS
is updated by JavaScript as the user adjusts the value of the spin button.Points
, e.g., 10 Points
.
+
+
+
+ aria-valuemin="8"
+ div
Indicates the minimum allowed value for the spin button, i.e., smallest supported font size.
+
+
+
+
+
+ aria-valuemax="40"
+ div
Indicates the maximum allowed value for the spin button, i.e., largest supported font size.
+ Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Toolbar Pattern
+
+ About This Pattern
+ 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.
+
+
+
+
+ Example
+ Keyboard Interaction
+
+
+
+
+
+
+ Note
+
+
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+ vertical
.
+ The default orientation is horizontal.
+ Tooltip Pattern
+
+ About This Pattern
+ Example
+ Keyboard Interaction
+ Note
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+ Treegrid Email Inbox Example
+
+ About This Example
+
+
+ Example Usage Options
+
+
+
+ Useful when the desired experience is for the treegrid to act primarily like a tree where each row is treated like a node in a tree, but it is still possible for users to navigate across the cells in a row.
+
+ Useful when the desired experience is for the treegrid to act primarily like a grid where arrow keys move among cells, but it is still possible for users to focus a row and then start navigating the structure like a tree.
+
+ Useful when the desired experience is that the treegrid act primarily like a grid and there is no need to focus complete rows.
+
+
+ Example
+
+
+
+
+
+
+ Subject
+ Summary
+ Email
+
+
+ Treegrids are awesome
+ Want to learn how to use them?
+ aaron@thegoogle.rocks
+
+
+ re: Treegrids are awesome
+ I agree with you, they are the shizzle
+ joe@blahblahblah.blahblah
+
+
+ re: Treegrids are awesome
+ They are great for showing a lot of data, like a grid
+ billy@dangerous.fish
+
+
+ re: Treegrids are awesome
+ Cool, we've been needing an example and documentation
+ doris@rufflazydogs.sleep
+
+
+ re: Treegrids are awesome
+ I hear the Fancytree library is going to align with this example!
+ someone@please-do-it.company
+
+
+ re: Treegrids are awesome
+ Sometimes they are more like trees, others are more like grids
+ mari@beingpractical.com
+
+
+ re: Treegrids are awesome
+ Cool, when it's a tree, let's keep left/right to collapse/expand
+ issie@imadeadcatsadly.wascute
+
+
+
+ re: Treegrids are awesome
+ I see, sometimes right arrow moves by column
+ kitten@kittenseason.future
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+
+ Right Arrow
+
+
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+
+
+ Down Arrow
+
+
+
+
+
+
+
+
+ Up Arrow
+
+
+
+
+
+
+
+
+ Tab
+
+
+
+
+
+
+
+
+ Shift + Tab
+
+
+
+
+
+
+
+
+ Home
+
+
+
+
+
+
+
+
+ End
+
+
+
+
+
+
+
+
+ Control + Home
+
+
+
+
+
+
+
+
+ Control + End
+
+
+
+
+
+
+
+
+
+ Enter
+
+
+
+
+
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ treegrid
+
+ table
Identifies the element as a
+ treegrid
.
+
+
+
+ aria-label="Inbox"
+ table
Provides an accessible name for the
+ treegrid
.
+
+
+ row
+
+ tr
+
+
+
+ row
.row
role is not an implicit semantic for the tr
element when in a treegrid
.
+
+
+
+ tabindex="-1"
+ tr
or td
+
+
+
+ row
and gridcell
elements are focusable, but only one is included in the tab sequence.
+
+
+
+ tabindex="0"
+ tr
or td
+
+
+
+ row
or gridcell
in the treegrid
has tabindex="0"
.row
in the treegrid
is included in the tab sequence when the page loads.treegrid
, the element included in the tab sequence changes to the element with focus as described in the practice for
+ Managing Focus Within Components Using a Roving tabindex.
+
+
+
+
+ aria-expanded="false"
+ tr
or td
+
+
+
+ aria-expanded
is on the tr
elements, but when the treegrid is configured to support focus on cells only, aria-expanded
is on the first td
element contained in each row.
+
+
+
+ aria-expanded="true"
+ tr
or td
+
+
+
+ aria-expanded
is on the tr
elements, but when the treegrid is configured to support focus on cells only, aria-expanded
is on the first td
element contained in each row.
+
+
+
+ aria-level="number"
+ tr
+
+
+
+
+
+
+
+ aria-setsize="number"
+ tr
Defines the number of rows in the set of rows that are in the same branch and at the same level within the hierarchy.
+
+
+
+
+ aria-posinset="number"
+ tr
+
+
+
+
+
+
+
+ gridcell
+
+ td
+
+
+
+ gridcell
.gridcell
role is not an implicit semantic for the td
element when in a treegrid
.aria-posinset
and aria-setsize
properties are not supported on row elements.
+ This is being corrected in ARIA 1.2.
+ Consequently, when validating the HTML in this example, errors are generated.
+ Javascript and CSS Source Code
+
+
+
+ HTML Source Code
+
+
+
+
+ Treegrid Pattern
+
+ About This Pattern
+ treegrid
used to display messages and message responses for a e-mail discussion list, messages with responses would be in rows that can be expanded to reveal the response messages.
+ treegrid
that are either not focusable or not used to label a column or row.
+ treegrid
, a visual keyboard indicator informs users which row or cell is focused.
+ If the treegrid
allows users to choose just one item for an action, then it is known as a single-select treegrid
, and the item with focus also has a selected state.
+ However, in a multi-select treegrid
, which enables users to select more than one row or cell for an action, the selected state is independent of the focus.
+ For example, in a hierarchical e-mail discussion grid, users can move focus to select any number of rows for an action, such as delete or move.
+ It is important that the visual design distinguish between items that are selected and the item that has focus.
+ For more details, see this description of differences between focus and selection.
+ Example
+ treegrid
Example: A treegrid for navigating an e-mail inbox that demonstrates three keyboard navigation models -- rows first, cells first, and cells only.Keyboard Interaction
+ treegrid
navigation by moving focus among rows and cells of the grid.
+ Implementations of treegrid
make these key commands available when an element in the grid has received focus, e.g., after a user has moved focus to the grid with Tab.
+ Moving focus into the grid may result in the first cell or the first row being focused.
+ Whether focus goes to a cell or the row depends on author preferences and whether row focus is supported, since some implementations of treegrid
may not provide focus to rows.
+
+
+ aria-expanded
property, opens or closes the child rows.,Otherwise, performs the default action for the cell.treegrid
widget to the next focusable element.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Note
+
+
+ treegrid
navigation keys move focus, whether the focus is set on an element inside the cell or on the cell depends on cell content.
+ See Whether to Focus on a Cell or an Element Inside It.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Note
+ WAI-ARIA Roles, States, and Properties
+
+
+ treegrid
element or an element with role rowgroup.row
element and has one of the following roles:
+
+
+ row
that can be expanded or collapsed to show or hide a set of child rows is a parent row.
+ Each parent row
has the aria-expanded state set on either the row
element or on a cell contained in therow
.
+ The aria-expanded
state is set to false
when the child rows are not displayed and set to true
when the child rows are displayed.
+ Rows that do not control display of child rows do not have the aria-expanded
attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent rows.
+ treegrid
has aria-multiselectable set to true
.
+ Otherwise, it is a single-select treegrid, and aria-multiselectable
is either set to false
or the default value of false
is implied.
+ true
on the selected row or cell, and it is not present on any other row or cell in the treegrid.
+
+ true
.false
.true
on cells where editing is disabled.
+ If edit functions are disabled for all cells, instead of setting aria-readonly
to true
on every cell, aria-readonly
may be set to true
on the treegrid
element.
+ Treegrids that do not provide cell content editing functions do not include the aria-readonly
attribute on any of their elements.
+
+
+ treegrid
role is NOT applied to an HTML table
element, then aria-rowspan or aria-colspan is applied as described in the
+ Grid and Table Properties Practice.
+ Note
+
+
+ treegrid
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
.treegrid
element unless the DOM descendants are also included in the aria-owns
attribute.File Directory Treeview Example Using Computed Properties
- My Documents
tree, each parent node represents a folder and each end node represents a file.
- Activating a node selects the node and puts the name of the folder or file in the read-only edit field that represents the file viewer.
- aria-setsize
, aria-posinset
, and aria-level
.
- The ARIA specification for these properties states that browsers can, but are not required to, compute their values.
- So, some browser and assistive technology combinations may not compute or report correct position and level information if it is not explicitly declared.
- If testing reveals gaps in support for these properties, override automatic computation by explicitly declaring their values as demonstrated in the example of a
- File Directory Treeview using declared properties.
- About This Example
+ My Documents
tree, each parent node represents a folder and each end node represents a file.
+ Activating a node selects the node and puts the name of the folder or file in the read-only edit field that represents the file viewer.
+ aria-setsize
, aria-posinset
, and aria-level
.
+ The ARIA specification for these properties states that browsers can, but are not required to, compute their values.
+ So, some browser and assistive technology combinations may not compute or report correct position and level information if it is not explicitly declared.
+ If testing reveals gaps in support for these properties, override automatic computation by explicitly declaring their values as demonstrated in the example of a File Directory Treeview using declared properties.
+ Example
- My Documents
-
+ My Documents
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
Accessibility Features
- Terms Used to Describe Trees
A tree item that can be expanded to reveal child items is called a parent node.
It is a closed node when the children are hidden and an open node when it is expanded.
An end node does not have any children.
- For a complete list of terms and definitions, see the
- Treeview Design Pattern.
+ For a complete list of terms and definitions, see the Treeview Pattern.
Keyboard Support
@@ -361,20 +247,18 @@
Keyboard Support
a-z, A-Z
-
-
@@ -383,7 +267,7 @@
- * (asterisk)
-
+ * (asterisk)
-
Keyboard Support
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
@@ -402,9 +286,8 @@
Role, Property, State, and Tabindex Attributes
@@ -419,7 +302,7 @@ ul
element as a tree
widget.tree
container does not need a tabindex
attribute.
+ The tree element is not focusable because it implements the practice described in
+ Managing Focus Within Components Using a Roving tabindex.
Role, Property, State, and Tabindex Attributes
treeitem
- li
Identifies the element as a
+ treeitem
.Identifies the element as a
treeitem
.
@@ -429,7 +312,7 @@ Role, Property, State, and Tabindex Attributes
+
treeitem
element focusable without including it in the tab sequence of the page.treeitem
elements are focusable, but only one is included in the tab sequence.
@@ -442,10 +325,10 @@
Role, Property, State, and Tabindex Attributes
treeitem
in the tree
has tabindex="0"
.treeitem
in the tree
is included in the tab sequence when the page loads.tree
, the element included in the tab sequence changes to the element with focus as described in the section on
- roving tabindex.
+ When the user moves focus in the tree
, the element included in the tab sequence changes to the element with focus as described in
+ Managing Focus Within Components Using a Roving tabindex.
@@ -465,7 +348,7 @@
Role, Property, State, and Tabindex Attributes
aria-expanded="true"
li
-
@@ -479,20 +451,18 @@
+
treeitem
elements that are parent nodes, i.e., they contain a ul
with the group
role.HTML Source Code
-
-
diff --git a/content/patterns/treeview/examples/treeview-1b.html b/content/patterns/treeview/examples/treeview-1b.html
new file mode 100644
index 0000000000..69d1580147
--- /dev/null
+++ b/content/patterns/treeview/examples/treeview-1b.html
@@ -0,0 +1,457 @@
+
+
+
+
+
+ File Directory Treeview Example Using Declared Properties
+ About This Example
+ My Documents
tree, each parent node represents a folder and each end node represents a file.
+ Activating a node selects the node and puts the name of the folder or file in the read-only edit field that represents the file viewer.
+ aria-setsize
, aria-posinset
and aria-level
, which overrides browser computation of values for these properties.
+ The ARIA specification for these properties states that browsers can, but are not required to, compute these values.
+ Example
+ My Documents
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Accessibility Features
+ Terms Used to Describe Trees
+ Keyboard Support
+
+
+
+
+
+
+
+ Key
+ Function
+
+
+ Enter
+ Performs the default action, which is to select the node, causing the name of the node to appear in the
+ File or Folder Selected
textbox.
+
+ Space
+ Performs the default action, which is to select the node, causing the name of the node to appear in the
+ File or Folder Selected
textbox.
+
+ Down arrow
+
+
+
+
+
+
+ Up arrow
+
+
+
+
+
+
+ Right Arrow
+
+
+
+
+
+
+ Left Arrow
+
+
+
+
+
+
+ Home
+ Moves focus to first node without opening or closing a node.
+
+
+ End
+ Moves focus to the last node that can be focused without expanding any nodes that are closed.
+
+
+ a-z, A-Z
+
+
+
+
+
+
+
+ * (asterisk)
+
+
+
+
+ Role, Property, State, and Tabindex Attributes
+
+
+
+
+
+
+
+ Role
+ Attribute
+ Element
+ Usage
+
+
+
+ tree
+
+ ul
+
+
+
+ ul
element as a tree
widget.
+
+
+
+ aria-labelledby="ID_REFERENCE"
+ ul
Refers to the heading element that contains the label that identifies the purpose of the
+ tree
.
+
+
+ treeitem
+
+ li
Identifies the element as a
+ treeitem
.
+
+
+
+ tabindex="-1"
+ li
+
+
+
+ treeitem
element focusable without including it in the tab sequence of the page.treeitem
elements are focusable, but only one is included in the tab sequence.
+
+
+
+ tabindex="0"
+ li
+
+
+
+ treeitem
element in the tab sequence.treeitem
in the tree
has tabindex="0"
.treeitem
in the tree
is included in the tab sequence when the page loads.tree
, the element included in the tab sequence changes to the element with focus as described in
+ Managing Focus Within Components Using a Roving tabindex.
+
+
+
+
+ aria-expanded="false"
+ li
+
+
+
+ treeitem
elements that are parent nodes, i.e., they contain a ul
with the group
role.
+
+
+
+ aria-expanded="true"
+ li
+
+
+
+ treeitem
elements that are parent nodes, i.e., they contain a ul
with the group
role.
+
+
+
+ aria-selected="false"
+ li
+
+
+
+ treeitem
elements.
+
+
+
+ aria-selected="true"
+ li
+
+
+
+ treeitem
elements.
+
+
+
+ aria-setsize="number"
+ li
Defines the number of
+ treeitem
elements in the set of treeitem
elements that are in the same branch and at the same level within the hierarchy.
+
+
+
+ aria-posinset="number"
+ li
+
+
+
+ treeitem
elements that are in the same branch and at the same level within the hierarchy.
+
+
+
+ aria-level="number"
+ li
+
+
+
+ treeitem
in the hierarchical tree structure.treeitem
elements have aria-level="1"
.
+
+
+
+ group
+
+ ul
+
+
+
+ ul
element as a container of treeitem
elements that form a branch of the tree.treeitem
.aria-level
, aria-setsize
and aria-posinset
values for the nodes contained in the branch if those properties are not specified explicitly in the code.Javascript and CSS Source Code
+
+
+ HTML Source Code
+
+
+
+
+ Keyboard Support
a-z, A-Z
-
-
@@ -501,7 +471,7 @@
- * (asterisk)
-
+ * (asterisk)
-
Keyboard Support
Role, Property, State, and Tabindex Attributes
+ Role, Property, State, and Tabindex Attributes
Landmarks
@@ -529,17 +499,15 @@
Landmarks
navigation
- nav
- Identifies the region containing the navigation tree.
-
+ Identifies the region containing the navigation tree.
-
+ aria-label="navigation label"
+
aria-label="navigation label"
+
- nav
- The
+ aria-label
attribute provides an accessible name for the navigation
landmark.
- The
aria-label
attribute provides an accessible name for the navigation
landmark.
@@ -556,9 +524,7 @@ region
Landmarks
aria-labelledby="IDREFs"
- section
- The
+ aria-labelledby
attribute provides an accessible name for the region
landmark by concatenating the website and page titles.
- The
aria-labelledby
attribute provides an accessible name for the region
landmark by concatenating the website and page titles.
@@ -593,9 +559,8 @@ contentinfo
Tree
@@ -610,7 +575,7 @@ ul
element as a tree
widget.tree
container does not need a tabindex
attribute.
+ The tree element is not focusable because it implements the practice described in
+ Managing Focus Within Components Using a Roving tabindex.
Tree
treeitem
- a
Identifies the element as a
+ treeitem
.Identifies the element as a
treeitem
.
@@ -664,7 +628,7 @@
@@ -631,8 +596,7 @@ Tree
treeitem
role in the tab sequence.treeitem
in the tree
has tabindex="0"
.tabindex="0"
is always on the treeitem with aria-current="page"
.
- tabindex="0"
is always on the treeitem with aria-current="page"
.Tree
aria-expanded="true"
a
-
+
treeitem
elements that are parent nodes, i.e., they have aria-owns
referencing a ul
with role group
.Tree
Javascript and CSS Source Code
HTML Source Code
-
Tree View Pattern
+
+ About This Pattern
+ Examples
+
+
+ aria-level
, aria-posinset
and aria-setsize
based on DOM structure.aria-level
, aria-posinset
and aria-setsize
.aria-level
, aria-posinset
and aria-setsize
based on DOM structure.Terms
+
+
+ Keyboard Interaction
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Note
+
+
+ tree
role supports the aria-activedescendant property, which provides an alternative to moving DOM focus among treeitem
elements when implementing keyboard navigation.
+ For details, see Managing Focus in Composites Using aria-activedescendant.
+
+
+ WAI-ARIA Roles, States, and Properties
+
+
+ tree
or referenced by an aria-owns property set on the tree
element.treeitem
that serves as a parent node has aria-expanded set to false
when the node is in a closed state and set to true
when the node is in an open state.
+ End nodes do not have the aria-expanded
attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent nodes.
+ tree
has aria-multiselectable set to true
.
+ Otherwise, aria-multiselectable
is either set to false
or the default value of false
is implied.
+
+
+ aria-selected
, then aria-checked
is not specified for any nodes.
+ Alternatively, if the selection state is indicated with aria-checked
, then aria-selected
is not specified for any nodes.
+ See notes below regarding considerations for which property to use and for details of the unusual conditions that might allow for both properties in the same tree.
+ true
.
+ No more than one node is selected at a time if the element with role tree
does not have aria-multiselectable set to true
.
+ false
.tree
has either a visible label referenced by aria-labelledby or a value specified for aria-label.tree
element is horizontally oriented, it has aria-orientation set to horizontal
.
+ The default value of aria-orientation
for a tree is vertical
.
+ Note
+
+
+ aria-selected
or aria-checked
are:
+
+
+ aria-selected
for single-select widgets and aria-checked
for multi-select widgets.
+ In the absence of factors that would make an alternative convention more appropriate, this is a recommended convention.
+ select
items? Or, is the visual indicator of selection a check mark?
+ aria-selected
and aria-checked
are extremely rare.
+ It is strongly recommended to avoid designing a tree widget that would have the need for more than one type of state.
+ If both states were to be used within a tree, all the following conditions need to be satisfied:
+
+
+ aria-selected
is different from the meaning and purpose of aria-checked
in the user interface.Window Splitter Pattern
+
+ About This Pattern
+ 100
, and when the table of contents is completely collapsed, the splitter has a value of 0
.
+ Example
+ Keyboard Interaction
+
+
+ Note
+ WAI-ARIA Roles, States, and Properties
+
+
+ 0
.
+ 100
.
+ Grid and Table Properties
+
+ Introduction
+
+
+
+
+
+
+
+
+ Property
+ Definition
+
+
+
+ aria-colcount
Defines the total number of columns in a
+ table
, grid
, or treegrid
.
+
+
+ aria-rowcount
Defines the total number of rows in a
+ table
, grid
, or treegrid
.
+
+
+ aria-colindex
+
+
+
+ table
, grid
, or treegrid
.
+
+
+ aria-rowindex
+
+
+
+ table
, grid
, or treegrid
.
+
+
+ aria-colspan
Defines the number of columns spanned by a cell or gridcell within a
+ table
, grid
, or treegrid
.
+
+
+ aria-rowspan
Defines the number of rows spanned by a cell or gridcell within a
+ table
, grid
, or treegrid
.
+
+
+
+ aria-sort
Indicates if items in a row or column are sorted in ascending or descending order.
+ Using
+ aria-rowcount
and aria-rowindex
aria-rowcount
property is used to communicate the total number of rows available, and it is accompanied by the aria-rowindex
property to identify the row indices of the rows that are present in the DOM.aria-rowcount
is specified on the element with the table
, grid
, or treegrid
role.
+ Its value is an integer equal to the total number of rows available, including header rows.
+ If the total number of rows is unknown, a value of -1
may be specified.
+ Using a value of -1
indicates that more rows are available to include in the DOM without specifying the size of the available supply.
+ aria-rowcount
is used on a table
, grid
, or treegrid
, a value for aria-rowindex
property is specified on each of its descendant rows, including any header rows.
+ The value of aria-rowindex
is an integer that is:
+
+
+ aria-rowindex
on any previous rows.aria-rowindex
could have devastating effects on assistive technology behavior.
+ For example, specifying an invalid value for aria-rowindex
or setting it on some but not all rows in a table, could cause screen reader table reading functions to skip rows or simply stop functioning.
+ aria-rowcount
and aria-rowindex
properties on a table containing a hypothetical class list.
+ <!--
+ aria-rowcount tells assistive technologies the actual size of the grid
+ is 463 rows even though only 4 rows are present in the markup.
+-->
+<table role="grid" aria-rowcount="463">
+ aria-label="Student roster for history 101"
+ <thead>
+ <tr aria-rowindex="1">
+ <th>Last Name</th>
+ <th>First Name</th>
+ <th>E-mail</th>
+ <th>Major</th>
+ <th>Minor</th>
+ <th>Standing</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!--
+ aria-rowindex tells assistive technologies that this
+ row is row 51 in the grid of 463 rows.
+ -->
+ <tr aria-rowindex="51">
+ <td>Henderson</td>
+ <td>Alan</td>
+ <td>ahederson56@myuniveristy.edu</td>
+ <td>Business</td>
+ <td>Spanish</td>
+ <td>Junior</td>
+ </tr>
+ <!--
+ aria-rowindex tells assistive technologies that this
+ row is row 52 in the grid of 463 rows.
+ -->
+ <tr aria-rowindex="52">
+ <td>Henderson</td>
+ <td>Alice</td>
+ <td>ahederson345@myuniveristy.edu</td>
+ <td>Engineering</td>
+ <td>none</td>
+ <td>Sophomore</td>
+ </tr>
+ <!--
+ aria-rowindex tells assistive technologies that this
+ row is row 53 in the grid of 463 rows.
+ -->
+ <tr aria-rowindex="53">
+ <td>Henderson</td>
+ <td>Andrew</td>
+ <td>ahederson75@myuniveristy.edu</td>
+ <td>General Studies</td>
+ <td>none</td>
+ <td>Freshman</td>
+ </tr>
+ </tbody>
+</table>
+
Using
+ aria-colcount
and aria-colindex
aria-colcount
property is used to communicate the total number of columns available, and it is accompanied by the aria-colindex
property to identify the column indices of the columns that are present in the DOM.aria-colcount
is specified on the element with the table
, grid
, or treegrid
role.
+ Its value is an integer equal to the total number of columns available.
+ If the total number of columns is unknown, a value of -1
may be specified.
+ Using a value of -1
indicates that more columns are available to include in the DOM without specifying the size of the available supply.
+ aria-colcount
is used on a table
, grid
, or treegrid
, a value for aria-colindex
property is either specified on each of its descendant rows or on every cell in each descendant row, depending on whether the columns are contiguous as described below.
+ The value of aria-colindex
is an integer that is:
+
+
+ aria-colindex
could have devastating effects on assistive technology behavior.
+ For example, specifying an invalid value for aria-colindex
or setting it on some but not all cells in a row, could cause screen reader table reading functions to skip cells or simply stop functioning.
+ Using
+ aria-colindex
When Column Indices Are Contiguousaria-colindex
can be set on the row element with a value equal to the index number of the first column in the set.
+ Browsers will then compute a column number for each cell in the row.
+ aria-colindex
can be placed on each row.
+
+ <div role="grid" aria-colcount="16">
+ <div role="rowgroup">
+ <div role="row" aria-colindex="2">
+ <span role="columnheader">First Name</span>
+ <span role="columnheader">Last Name</span>
+ <span role="columnheader">Company</span>
+ <span role="columnheader">Address</span>
+ </div>
+ </div>
+ <div role="rowgroup">
+ <div role="row" aria-colindex="2">
+ <span role="gridcell">Fred</span>
+ <span role="gridcell">Jackson</span>
+ <span role="gridcell">Acme, Inc.</span>
+ <span role="gridcell">123 Broad St.</span>
+ </div>
+ <div role="row" aria-colindex="2">
+ <span role="gridcell">Sara</span>
+ <span role="gridcell">James</span>
+ <span role="gridcell">Acme, Inc.</span>
+ <span role="gridcell">123 Broad St.</span>
+ </div>
+ …
+ </div>
+</div>
+
Using
+ aria-colindex
When Column Indices Are Not Contiguousaria-colindex
needs to be set on each cell in the row.
+ The following example shows a grid for an online grade book where the first two columns contain a student name and subsequent columns contain scores.
+ In this example, the first two columns with the student name are shown, but the score columns have been scrolled to show columns 10 through 13.
+ Columns 3 through 9 are not visible so are not in the DOM.
+
+ <table role="grid" aria-rowcount="463" aria-colcount="13">
+ aria-label="Student grades for history 101"
+ <!--
+ aria-rowcount and aria-colcount tell assistive technologies
+ the actual size of the grid is 463 rows by 13 columns,
+ which is not the number rows and columns found in the markup.
+ -->
+ <thead>
+ <tr aria-rowindex="1">
+ <!--
+ aria-colindex tells assistive technologies that the
+ following columns represent columns 1 and 2 of the total data set.
+ -->
+ <th aria-colindex="1">Last Name</th>
+ <th aria-colindex="2">First Name</th>
+ <!--
+ aria-colindex tells users of assistive technologies that the
+ following columns represent columns 10, 11, 12, and 13 of
+ the overall data set of grades.
+ -->
+ <th aria-colindex="10">Homework 4</th>
+ <th aria-colindex="11">Quiz 2</th>
+ <th aria-colindex="12">Homework 5</th>
+ <th aria-colindex="13">Homework 6</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr aria-rowindex="50">
+ <!--
+ every cell needs to define the aria-colindex attribute
+ -->
+ <td aria-colindex="1">Henderson</td>
+ <td aria-colindex="2">Alan</td>
+ <td aria-colindex="10">8</td>
+ <td aria-colindex="11">25</td>
+ <td aria-colindex="12">9</td>
+ <td aria-colindex="13">9</td>
+ </tr>
+ <tr aria-rowindex="51">
+ <td aria-colindex="1">Henderson</td>
+ <td aria-colindex="2">Alice</td>
+ <td aria-colindex="10">10</td>
+ <td aria-colindex="11">27</td>
+ <td aria-colindex="12">10</td>
+ <td aria-colindex="13">8</td>
+ </tr>
+ <tr aria-rowindex="52">
+ <td aria-colindex="1">Henderson</td>
+ <td aria-colindex="2">Andrew</td>
+ <td aria-colindex="10">9</td>
+ <td aria-colindex="11">0</td>
+ <td aria-colindex="12">29</td>
+ <td aria-colindex="13">8</td>
+ </tr>
+ </tbody>
+</table>
Defining cell spans using
+ aria-colspan
and aria-rowspan
table
elements, row and column spans are defined with the aria-rowspan
and aria-colspan
properties.aria-colspan
is an integer that is:
+
+ aria-rowspan
is an integer that is:
+
+
+ <div role="grid" aria-rowcount="463"
+ aria-label="Student grades for history 101">
+ <div role="rowgroup">
+ <div role="row" aria-rowindex="1">
+ <!--
+ aria-rowspan and aria-colspan provide
+ assistive technologies with the correct data cell header information
+ when header cells span more than one row or column.
+ -->
+ <span role="columnheader" aria-rowspan="2">Last Name</span>
+ <span role="columnheader" aria-rowspan="2">First Name</span>
+ <span role="columnheader" aria-colspan="2">Test 1</span>
+ <span role="columnheader" aria-colspan="2">Test 2</span>
+ <span role="columnheader" aria-colspan="2">Final</span>
+ </div>
+ <div role="row" aria-rowindex="2">
+ <span role="columnheader">Score</span>
+ <span role="columnheader">Grade</span>
+ <span role="columnheader">Score</span>
+ <span role="columnheader">Grade</span>
+ <span role="columnheader">Total</span>
+ <span role="columnheader">Grade</span>
+ </div>
+ </div>
+ <div role="rowgroup">
+ <div role="row" aria-rowindex="50">
+ <span role="cell">Henderson</span>
+ <span role="cell">Alan</span>
+ <span role="cell">89</span>
+ <span role="cell">B+</span>
+ <span role="cell">72</span>
+ <span role="cell">C</span>
+ <span role="cell">161</span>
+ <span role="cell">B-</span>
+ </div>
+ <div role="row" aria-rowindex="51">
+ <span role="cell">Henderson</span>
+ <span role="cell">Alice</span>
+ <span role="cell">94</span>
+ <span role="cell">A</span>
+ <span role="cell">86</span>
+ <span role="cell">B</span>
+ <span role="cell">180</span>
+ <span role="cell">A-</span>
+ </div>
+ <div role="row" aria-rowindex="52">
+ <span role="cell">Henderson</span>
+ <span role="cell">Andrew</span>
+ <span role="cell">82</span>
+ <span role="cell">B-</span>
+ <span role="cell">95</span>
+ <span role="cell">A</span>
+ <span role="cell">177</span>
+ <span role="cell">B+</span>
+ </div>
+ </div>
+</div>
table
elements, use the native semantics of the th
and td
elements to define row and column spans by using the rowspan
and colspan
attributes.Indicating sort order with
+ aria-sort
aria-sort
property can be applied to a column or row header to indicate the sorting method.
+ The following table describes allowed values for aria-sort
.
+
+
+ aria-sort
+
+
+
+ Value
+ Description
+
+
+
+ ascending
Data are sorted in ascending order.
+
+
+
+ descending
Data are sorted in descending order.
+
+
+
+ other
Data are sorted by an algorithm other than ascending or descending.
+
+
+
+
+ none
Default (no sort applied).
+ aria-sort
with a value other than none
to more than one column or row.
+ aria-sort
to indicate the rows are sorted from the highest "Quiz 2" score to the lowest "Quiz 2" score.
+ <table role="grid" aria-rowcount="463" aria-colcount="13"
+ aria-label="Student grades for history 101">
+ <thead>
+ <tr aria-colindex="10" aria-rowindex="1">
+ <th>Homework 4</th>
+ <!--
+ aria-sort indicates the column with the heading
+ "Quiz 2" has been used to sort the rows of the grid.
+ -->
+ <th aria-sort="descending">Quiz 2</th>
+ <th>Homework 5</th>
+ <th>Homework 6</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr aria-colindex="10" aria-rowindex="50">
+ <td>8</td>
+ <td>30</td>
+ <td>9</td>
+ <td>9</td>
+ </tr>
+ <tr aria-colindex="10" aria-rowindex="51">
+ <td>10</td>
+ <td>29</td>
+ <td>10</td>
+ <td>8</td>
+ </tr>
+ <tr aria-colindex="10" aria-rowindex="52">
+ <td>9</td>
+ <td>9</td>
+ <td>27</td>
+ <td>6</td>
+ </tr>
+ <tr aria-colindex="10" aria-rowindex="53">
+ <td>9</td>
+ <td>10</td>
+ <td>26</td>
+ <td>8</td>
+ </tr>
+ <tr aria-colindex="10" aria-rowindex="54">
+ <td>9</td>
+ <td>7</td>
+ <td>24</td>
+ <td>6</td>
+ </tr>
+ </tbody>
+</table>
Hiding Semantics with the
+
+ presentation
RoleIntroduction
+ presentation
.
+ ul
element.
+ <ul role="tablist">
+ <li role="presentation">
+ <a role="tab" href="#">Tab 1</a>
+ </li>
+ <li role="presentation">
+ <a role="tab" href="#">Tab 2</a>
+ </li>
+ <li role="presentation">
+ <a role="tab" href="#">Tab 3</a>
+ </li>
+</ul>
+
presentation
to the li
elements tells browsers to leave those elements out of their accessibility tree.
+ Assistive technologies will thus be unaware of the list item elements and see the tab elements as immediate children of the tablist.
+ Common Uses of Role
+ presentation
presentation
are:
+
+ Effects of Role
+ presentation
role="presentation"
is specified on an element, if a condition that requires a browser to ignore the presentation
role does not exist, it has the following three effects.
+
+
+ display: none
or has aria-hidden="true"
is not visible to assistive technologies.
+
+
+ presentation
is applied to a ul
or ol
element, each child li
element inherits the presentation
role because ARIA requires the listitem
elements to have the parent list
element.
+ So, the li
elements are not exposed to assistive technologies, but elements contained inside of those li
elements, including nested lists, are visible to assistive technologies.
+ presentation
is applied to a table
element, the descendant caption
, thead
, tbody
, tfoot
, tr
, th
, and td
elements inherit role presentation
and are thus not exposed to assistive technologies.
+ But, elements inside of the th
and td
elements, including nested tables, are exposed to assistive technologies.
+ Conditions That Cause Role
+ presentation
to be Ignoredrole="presentation"
, and it therefore has no effect, if either of the following are true about the element to which it is applied:
+
+ tabindex
attribute.aria-label
.Example Demonstrating Effects of the
+ presentation
Rolepresentation
suppresses the list and list item semantics.
+ <ul role="presentation">
+ <li>Date of birth:</li>
+ <li>January 1, 3456</li>
+</ul>
+
+ <div>Date of birth:</div>
+<div>January 1, 3456</div>
+
Roles That Automatically Hide Semantics by Making Their Descendants Presentational
+ presentation
to all descendant elements of any element with a role that cannot support semantic children.
+
+
+
+ <li role="tab"><h2>Title of My Tab</h2></li>
+ <li role="tab"><h2 role="presentation">Title of My Tab</h2></li>
presentation
, the previous code is equivalent to the following.
+
+ <li role="tab">Title of My Tab</li>
Developing a Keyboard Interface
+
+ Introduction
+
+
+ Discernible and Predictable Keyboard Focus
+
+
+
+
+
+
+
+
+ Focus VS Selection and the Perception of Dual Focus
+
+ aria-selected="true"
.
+
+
+ Deciding When to Make Selection Automatically Follow Focus
+ Keyboard Navigation Between Components (The Tab Sequence)
+
+
+
+ Keyboard Navigation Inside Components
+
+
+
+
+ Managing Focus Within Components Using a Roving tabindex
+
+
+
+
+ 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.
+
+ tabindex="-1"
on the element that has tabindex="0"
.tabindex="0"
on the element that will become focused as a result of the key event.element.focus()
, on the element that has tabindex="0"
.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"
.
+ Managing Focus in Composites Using aria-activedescendant
+
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+ Focusability of disabled controls
+
+
+
+
+
+
+
+ Key Assignment Conventions for Common Functions
+
+
+
+
+
+
+
+ Function
+ Windows/Linux Key
+ macOS Key
+
+
+ open context menu
+ Shift + F10
+
+
+
+ Copy to clipboard
+ Control + C
+ Command + C
+
+
+ Paste from clipboard
+ Control + V
+ Command + V
+
+
+ Cut to clipboard
+ Control + X
+ Command + X
+
+
+ undo last action
+ Control + Z
+ Command + Z
+
+
+
+ Redo action
+ Control + Y
+ Command + Shift + Z
+ Keyboard Shortcuts
+
+
+ Designing the Scope and Behavior of Keyboard Shortcuts
+
+
+
+
+
+
+ Ensure Basic Access Via Navigation
+
+
+
+ Choose Appropriate Shortcut Behavior
+
+
+
+ Choose Where to Add Shortcuts
+
+
+ Assigning Keyboard Shortcuts
+
+
+ Note
+ Operating System Key Conflicts
+
+
+
+
+
+
+ Assistive Technology Key Conflicts
+
+
+
+ Browser Key Conflicts
+
+
+
+ Intentional Key Conflicts
+
+
+
+
+ Landmark Regions
+
+ Introduction
+ HTML Sectioning Elements
+
+
+
+
+
+
+
+ HTML 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
+
+
+
+
+
+
+ banner
, main
, complementary
and contentinfo
landmarks should be top level landmarks.
+
+ Search Results
.
+ In this case, adding extra information to the label that distinguishes the two instances may be more distracting than helpful.
+ h1-h6
) it can be used as the label for the area using the aria-labelledby
attribute.aria-label
attribute.Landmark Roles
+
+
+
+ Complementary
+
+ 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).region
).complementary
landmark, each should have a unique label (see Step 3 above).HTML Technique
+
+ aside
element to define a complementary
landmark.ARIA Technique
+
+ aside
element technique is not being used, use a role="complementary"
attribute to define a complementary
landmark.Examples
+
+
+ Contentinfo
+
+ 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.
+
+
+ contentinfo
landmark.contentinfo
landmark should be a top-level landmark.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.contentinfo
landmark, each should have a unique label (see Step 3 above).HTML Techniques
+
+
+
+
+ footer
element defines a contentinfo
landmark when its context is the body
element.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
+
+ footer
element technique is not being used, a role="contentinfo"
attribute should be used to define a contentinfo
landmark.Examples
+
+ Form
+
+ 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).
+
+
+ search
landmark instead of the form
landmark when the form is used for search functionality.form
landmark should have a label to help users understand the purpose of the form.form
landmark should be visible to all users (e.g. an h1-h6
element).form
landmark, each should have a unique label (see Step 3 above).form
landmark in an HTML document should use native host semantics:
+
+
+ button
input
select
textarea
HTML Techniques
+
+ form
element defines a form
landmark when it has an accessible name (e.g. aria-labelledby
, aria-label
or title
).ARIA Technique
+
+ role="form"
to identify a region of the page; do not use it to identify every form field.Examples
+
+
+ Main
+
+ main
landmark identifies the primary content of the page.
+
+
+ main
landmark.main
landmark should be a top-level landmark.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.main
landmark, each should have a unique label (see Step 3 above).HTML Technique
+
+ main
element to define a main
landmark.ARIA Technique
+
+ main
element technique is not being used, use a role="main"
attribute to define a main
landmark.Examples
+
+
+ Region
+
+ 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.
+
+
+ region
landmark must have a label.region
landmark, each should have a unique label (see Step 3 above).region
landmark can be used identify content that named landmarks do not appropriately describe.HTML Technique
+
+ section
element defines a region
landmark when it has an accessible name (e.g. aria-labelledby
, aria-label
or title
).ARIA Technique
+
+ section
element technique is not being used, use a role="region"
attribute to define a region
landmark.Examples
+
+
+ Search
+
+ search
landmark contains a collection of items and objects that, as a whole, combine to create search functionality.
+
+
+ search
landmark instead of the form
landmark when the form is used for search functionality.search
landmark, each should have a unique label (see Step 3 above).HTML Technique
+ search
landmark.ARIA Technique
+
+ role="search"
attribute defines a search
landmark.Examples
+
+
+ Providing Accessible Names and Descriptions
+
+ Introduction
+
+
+
+
+ aria-label
.aria-labelledby
.
+
+ aria-describedby
.What ARE Accessible Names and Descriptions?
+
+
+ Mute Conversation
could be spoken as Mute Conversation button
.
+ If an element has a state, it could be announced either before or after the name and role; after name and role is the typical default.
+ For example, a switch button named Mute Conversation
in the off
state could be announced as Mute Conversation switch button off
.
+ Because descriptions are optional strings that are usually significantly longer than names, they are presented last, sometimes after a slight delay.
+ For example, Mute Conversation Switch button off, Silences alerts and notifications about activity in this conversation.
+ To reduce verbosity, some screen readers do not announce descriptions by default but instead inform users of their presence so that users can press a key that will announce the description.
+ How Are Name and Description Strings Derived?
+ Cardinal Rules of Naming
+
+ Rule 1: Heed Warnings and Test Thoroughly
+ Rule 2: Prefer Visible Text
+ Rule 3: Prefer Native Techniques
+ label
element for form elements and caption
element for tables.
+ While less flexible, their simplicity and reliance on visible text help ensure robust accessible experiences.
+ Several of the naming techniques highlight specific accessibility advantages of using HTML features instead of ARIA attributes.
+ Rule 4: Avoid Browser Fallback
+ title
and placeholder
attributes are used as last resort sources of content for accessible names.
+ Because the purpose of these attributes is not naming, their content typically yields low quality accessible names that are not effective.
+ Rule 5: Compose Brief, Useful Names
+ Naming Techniques
+
+ Naming with Child Content
+
+
+ <a href="/">Home</a>
+
+ menu
element is excluded.)group
element is excluded.)group
descendants of treeitem
elements and menu
descendants of menuitem
elements are omitted from the calculation.
+ For example, in the following tree
, the name of the first tree item is Fruits
; Apples
, Bananas
, and Oranges
are omitted.
+
+ <ul role="tree">
+ <li role="treeitem">Fruits
+ <ul role="group">
+ <li role="treeitem">Apples</li>
+ <li role="treeitem">Bananas</li>
+ <li role="treeitem">Oranges</li>
+ </ul>
+ </li>
+</ul>
Warning
+ aria-label
or aria-labelledby
, content contained in the element and its descendants is hidden from assistive technology users unless the descendant content is referenced by aria-labelledby
.
+ It is strongly recommended to avoid using either of these attributes to override content of one of the above elements except in rare circumstances where hiding content from assistive technology users is beneficial.
+ In addition, in situations where visible content is hidden from assistive technology users by use of one of these attributes, thorough testing with assistive technologies is particularly important.Naming with a String Attribute Via
+ aria-label
+ <button type="button" aria-label="Close">X</button>
aria-label
property is useful when there is no visible text content that will serve as an appropriate accessible name.aria-label
property affects assistive technology users in one of two different ways, depending on the role of the element to which it is applied.
+ When applied to an element with one of the roles that supports naming from child content, aria-label
hides descendant content from assistive technology users and replaces it with the value of aria-label
.
+ However, when applied to nearly any other type of element, assistive technologies will render both the value of aria-label
and the content of the element.
+ For example, the name of the following navigation region is "Product".
+
+ <nav aria-label="Product">
+ <!-- list of navigation links to product pages -->
+</nav>
Warning
+
+
+ aria-label
is applied to an element with one of the roles that supports naming from child content, content contained in the element and its descendants is hidden from assistive technology users.
+ It is strongly recommended to avoid using aria-label
to override content of one of these elements except in rare circumstances where hiding content from assistive technology users is beneficial.
+ aria-label
.
+ They are identified in the table in the Accessible Name Guidance by Role section.
+ aria-label
is not rendered visually, testing with assistive technologies to ensure the expected name is presented to users is particularly important.aria-label
values are translated.Naming with Referenced Content Via
+ aria-labelledby
+ <span id="night-mode-label">Night mode</span>
+<span role="switch" aria-checked="false" tabindex="0" aria-labelledby="night-mode-label"></span>
aria-labelledby
is similar in this situation to using an HTML label
element with the for
attribute, one significant difference is that browsers do not automatically make clicking on the labeling element activate the labeled element; that is an author responsibility.
+ However, HTML label
cannot be used to label a span
element.
+ Fortunately, an HTML input
with type="checkbox"
allows the ARIA switch
role, so when feasible, using the following approach creates a more robust solution.
+
+ <label for="night-mode">Night mode</label>
+<input type="checkbox" role="switch" id="night-mode">
aria-labelledby
property is useful in a wide variety of situations because:
+
+ aria-label
.hidden
attribute, CSS display: none
, or CSS visibility: hidden
in the calculated name string.aria-labelledby
could be a label for a night switch control:
+ <span id="night-mode-label" hidden>Night mode</span>
+<input type="checkbox" role="switch" aria-labelledby="night-mode-label">
aria-labelledby
has highest precedence in name calculation, in those situations, it is possible to use aria-labelledby
to reference both the element itself and the other element.
+ In the following example, the "Read more..." link is named by the element itself and the article’s heading, resulting in a name for the link of "Read more... 7 ways you can help save the bees".
+
+ <h2 id="bees-heading">7 ways you can help save the bees</h2>
+<p>Bees are disappearing rapidly. Here are seven things you can do to help.</p>
+<p><a id="bees-read-more" aria-labelledby="bees-read-more bees-heading">Read more...</a></p>
aria-labelledby
, text content from each referenced element is concatenated in the order specified in the aria-labelledby
value.
+ If an element is referenced more than one time, only the first reference is processed.
+ When concatenating content from multiple elements, browsers trim leading and trailing white space and separate content from each element with a single space.
+
+ <button id="download-button" aria-labelledby="download-button download-details">Download</button>
+<span id="download-details">PDF, 2.4 MB</span>
Warning
+
+
+ aria-labelledby
property cannot be chained, i.e., if an element with aria-labelledby
references another element that also has aria-labelledby
, the aria-labelledby
attribute on the referenced element will be ignored.aria-labelledby
more than one time during a name calculation, the second and any subsequent references will be ignored.aria-labelledby
.
+ They are identified in the table in the Accessible Name Guidance by Role section.
+ aria-labelledby
is applied to an element with one of the roles that supports naming from child content, content contained in the element and its descendants is hidden from assistive technology users unless it is also referenced by aria-labelledby
.
+ It is strongly recommended to avoid using this attribute to override content of one of these elements except in rare circumstances where hiding content from assistive technology users is beneficial.
+ aria-labelledby
can be complex and reference hidden content, testing with assistive technologies to ensure the expected name is presented to users is particularly important.Naming Form Controls with the Label Element
+ label
element enables authors to identify content that serves as a label and associate it with a form control.
+ When a label
element is associated with a form control, browsers calculate an accessible name for the form control from the label
content.
+ label
element as follows gives the checkbox an accessible name.
+
+ <label>
+ <input type="checkbox" name="subscribe">
+ subscribe to our newsletter
+</label>
for
attribute on the label
element.
+ This allows the label and the form control to be siblings or have different parents in the DOM, but requires adding an id
attribute to the form control, which can be error-prone.
+ When possible, use the above encapsulation technique for association instead of the following for
attribute technique.
+
+ <input type="checkbox" name="subscribe" id="subscribe_checkbox">
+<label for="subscribe_checkbox">subscribe to our newsletter</label>
label
element is an effective technique for satisfying Rule 2: Prefer Visible Text.
+ It also satisfies Rule 3: Prefer Native Techniques.
+ Native HTML labels offer an important usability and accessibility advantage over ARIA labeling techniques: browsers automatically make clicking the label equivalent to clicking the form control.
+ This increases the hit area of the form control.
+ Naming Fieldsets with the Legend Element
+ fieldset
element can be used to group form controls, and the legend
element can be used to give the group a name.
+ For example, a group of radio buttons can be grouped together in a fieldset
, where the legend
element labels the group for the radio buttons.
+
+ <fieldset>
+ <legend>Select your starter class</legend>
+ <label><input type="radio" name="starter-class" value="green">Green</label>
+ <label><input type="radio" name="starter-class" value="red">Red</label>
+ <label><input type="radio" name="starter-class" value="blue">Blue</label>
+</fieldset>
fieldset
and legend
.
+ <fieldset>
+ <legend>Shipping address</legend>
+ <p><label>Full name <input name="name" required></label></p>
+ <p><label>Address line 1 <input name="address-1" required></label></p>
+ <p><label>Address line 2 <input name="address-2"></label></p>
+ ...
+</fieldset>
+<fieldset>
+ <legend>Billing address</legend>
+ ...
+</fieldset>
legend
element to name a fieldset
element satisfies Rule 2: Prefer Visible Text and Rule 3: Prefer Native Techniques.Naming Tables and Figures with Captions
+ table
and figure
elements can be derived from a child caption
or figcaption
element, respectively.
+ Tables and figures often have a caption to explain what they are about, how to read them, and sometimes giving them numbers used to refer to them in surrounding prose.
+ Captions can help all users better understand content, but are especially helpful to users of assistive technologies.
+ table
element marks up a data table, and can be provided with a caption using the caption
element.
+ If the table
element does not have aria-label
or aria-labelledby
, then the caption
will be used as the accessible name.
+ For example, the accessible name of the following table is Special opening hours
.
+
+ <table>
+ <caption>Special opening hours</caption>
+ <tr><td>30 May</td><td>Closed</td></tr>
+ <tr><td>6 June</td><td>11:00-16:00</td></tr>
+</table>
Table 1
) so it can be referenced.
+ <table>
+ <caption>Table 1. Traditional dietary intake of Okinawans and other Japanese circa 1950</caption>
+ <thead>
+ <tr>
+ <th></th>
+ <th>Okinawa, 1949</th>
+ <th>Japan, 1950</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th>Total calories</th>
+ <td>1785</td>
+ <td>2068</td>
+
+ [...]
+
+</table>
table
is named using aria-label
or aria-labelledby
, then a caption
element, if present, will become an accessible description.
+ For an example, see Describing Tables and Figures with Captions.
+ figure
element can be given a caption using the figcaption
element.
+ The caption can appear before or after the figure, but it is more common for figures to have the caption after.
+
+ <figure>
+ <img alt="Painting of a person walking in a desert." src="Hole_JesusalDesierto.jpg">
+ <figcaption>Jesus entering the desert as imagined by William Hole, 1908</figcaption>
+</figure>
table
elements, if a figure
is not named using aria-label
or aria-labelledby
, the content of the figcaption
element will be used as the accessible name.
+ However unlike table
elements, if the figcaption
element is not used for the name, it does not become an accessible description unless it is referenced by aria-describedby
.
+ Nevertheless, assistive technologies will render the content of a figcaption
regardless of whether it is used as a name, description, or neither.
+ caption
element to name a table
element, or a figcaption
element to name a figure
element, satisfies Rule 2: Prefer Visible Text and Rule 3: Prefer Native Techniques.Fallback Names Derived from Titles and Placeholders
+ aria-label
or aria-labelledby
attributes), or native markup techniques (e.g., the HTML label
element, or the alt
attribute of the HTML img
element), browsers calculate an accessible name from other attributes as a fallback mechanism.
+ Because the attributes used in fallback name calculation are not intended for naming, they typically yield low quality accessible names that are not effective.
+ So, As advised by Rule 4: Avoid Browser Fallback, prefer the explicit labeling techniques described above over fallback techniques described in this section.
+ title
attribute specified.
+ The title
attribute may be used as the element's fallback accessible name.
+ The title
attribute is commonly presented visually as a tooltip when the user hovers over the element with a pointing device, which is not particularly discoverable, and is also not accessible to visual users without a pointing device.
+ fieldset
element without a legend
element child, but with a title
attribute, gets its accessible name from the title
attribute.
+ <fieldset title="Select your starter class">
+ <label><input type="radio" name="starter-class" value="green">Green</label>
+ <label><input type="radio" name="starter-class" value="red">Red</label>
+ <label><input type="radio" name="starter-class" value="blue">Blue</label>
+</fieldset>
input
and textarea
elements, the placeholder
attribute is used as a fallback labeling mechanism if nothing else (including the title
attribute) results in a label.
+ It is better to use a label
element, since it does not disappear visually when the user focuses the form control.
+
+ <!-- Using a <label> is recommended -->
+<label>Search <input type=search name=q></label>
+
+<!-- A placeholder is used as fallback -->
+<input type=search name=q placeholder="Search">
Composing Effective and User-friendly Accessible Names
+
+
+ X
closes a dialog, name it Close
, not X
.
+ Similarly, if a set of navigation links in the left side bar navigate among the product pages in a shopping site, name the navigation region Product
, not Left
.
+ Edit
, Delete
, and Actions
buttons for each contact, then Edit John Doe
, Delete John Doe
, and Actions for John Doe
would be better accessible names than John Doe edit
, John Doe delete
, and John Doe actions
.
+ By placing the verb first in the name, screen reader users can more easily and quickly distinguish the buttons from one another as well as from the element that opens the contact card for John Doe.
+ button
in the name of a button, the word image
in the name of an image, or the word navigation
in the name of a navigation region.
+ Doing so would create duplicate screen reader output since screen readers convey the role of an element in addition to its name.
+ Accessible Name Guidance by Role
+
+
+
+
+ aria-label
or aria-labelledby
is applied, content contained in the element and its descendants is hidden from assistive technology users unless it is also referenced by aria-labelledby
.
+ Avoid hiding descendant content except in the rare circumstances where doing so benefits assistive technology users.
+
+
+
+
+
+
+
+ role
+ Necessity of Naming
+ Guidance
+
+
+
+
+ alert
+ Discretionary
+
+ Some screen readers announce the name of an alert before announcing the content of the alert.
+ Thus,
+ aria-label
provides a method for prefacing the visible content of an alert with text that is not displayed as part of the alert.
+ Using aria-label
is functionally equivalent to providing off-screen text in the contents of the alert, except off-screen text would be announced by screen readers that do not support aria-label
on alert
elements.
+
+
+
+
+ alertdialog
+ Required
+ Use
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ application
+ Required
+ Use
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ article
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ banner
+ Discretionary
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ blockquote
+ Discretionary
+ If a visible label is present, associating it with the blockquote by using
+ aria-labelledby
could benefit some assistive technology users.
+
+
+
+ button
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.
+
+
+
+ caption
+ Prohibited
+
+
+
+
+
+ cell
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.cell
; the name of a cell in a table is its content.
+ Headers are complementary information.
+
+
+
+
+ checkbox
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.type="checkbox"
, use a label
element.aria-labelledby
.
+
+
+
+ code
+ Prohibited
+
+
+
+
+
+ columnheader
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.columnheader
role is implied from an HTML th
, the HTML abbr
attribute can be used to specify an abbreviated version of the name that is only announced when screen readers are reading an associated cell
within the table
, grid
, or treegrid
.
+
+
+
+ combobox
+ Required
+
+
+
+
+ combobox
role is applied to an HTML select
or input
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ complementary
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ contentinfo
+ Discretionary
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ definition
+ Recommended
+ Reference the term being defined with
+ role="term"
, using aria-labelledby
.
+
+
+
+ deletion
+ Prohibited
+
+
+
+
+
+ dialog
+ Required
+ Use
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ directory
+ Discretionary
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ document
+ Discretionary
+
+ Elements with the
+ document
role are contained within an element with the application
role, which is required to have a name.
+ Typically, the name of the application
element will provide sufficient context and identity for the document
element.
+ Because the application
element is used only to create unusual, custom widgets, careful assessment is necessary to determine whether or not adding an accessible name is beneficial.
+
+
+
+
+ emphasis
+ Prohibited
+
+
+
+
+
+ feed
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ figure
+ Recommended
+
+
+
+
+ figure
and figcaption
elements.
+ The figcaption
will serve as the accessible name for the figure
.
+ See the Naming Tables and Figures with Captions section.
+ aria-labelledby
on the figure, pointing to the figure's caption.aria-label
can be used.
+
+
+
+ form
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ generic
+ Prohibited
+
+
+
+
+
+ grid
+ Required
+
+
+
+
+ grid
is applied to an HTML table
element, then the accessible name can be derived from the table's caption
element.aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ gridcell
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.gridcell
; the name of a cell in a grid is its content.
+ Headers are complementary information.
+
+
+
+
+ group
+ Discretionary
+
+
+
+
+ fieldset
element, the accessible name can be derived from the legend
element.details
element, do not provide an accessible name for this element.
+ The user interacts with the summary
element, and that can derive its accessible name from its contents.
+ optgroup
element, use the label
attribute.aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ heading
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.
+
+
+
+ insertion
+ Prohibited
+
+
+
+
+
+ img
+ Required
+
+ For the HTML
+ img
element, use the alt
attribute.
+ For other elements with the img
role, use aria-labelledby
or aria-label
.
+
+
+
+
+ link
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.
+
+
+
+ list
+ Discretionary
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ listbox
+ Required
+
+
+
+
+ listbox
role is applied to an HTML select
element (with the multiple
attribute or a size
attribute having a value greater than 1), can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ listitem
+ Do Not Name
+ Naming is not supported by assistive technologies; it is necessary to include relevant content within the list item.
+
+
+
+
+ log
+ Discretionary
+
+ Some screen readers announce the name of a log element before announcing the content of the log element.
+ Thus,
+ aria-label
provides a method for prefacing the visible content of a log element with text that is not displayed as part of the log element.
+ Using aria-label
is functionally equivalent to providing off-screen text in the contents of the log element, except off-screen text would be announced by screen readers that do not support aria-label
on log
elements.
+
+
+
+
+ main
+ Discretionary
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ marquee
+ Discretionary
+ Use
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ math
+ Recommended
+
+
+
+
+ math
element has only presentational children and the accessible name is intended to convey the mathematical expression, use aria-label
to provide a string that represents the expression.math
element contains navigable content that conveys the mathematical expression and a visible label for the expression is present, use aria-labelledby
.aria-label
to name the expression, e.g., aria-label="Pythagorean Theorem"
.
+
+
+
+ menu
+ Recommended
+
+
+
+
+ aria-labelledby
to refer to the menuitem or button that controls this element's display.aria-label
.
+
+
+
+ menubar
+ Recommended
+
+
+
+
+ menuitem
elements in a menubar
.
+ Naming a menubar
is comparable to naming a menu button.
+ The name of a button
that opens a menu
conveys the purpose of the menu it opens.
+ Since a menubar
element is displayed persistently, a name on the menubar
can serve that same purpose.
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ menuitem
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.menu
is automatically excluded from the accessible name calculation.
+
+
+
+ menuitemcheckbox
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.
+
+
+
+ menuitemradio
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.
+
+
+
+ meter
+ Required
+
+
+
+
+ meter
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ navigation
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ none
+ Prohibited
+ An element with
+ role="none"
is not part of the accessibility tree (except in error cases). Do not use aria-labelledby
or aria-label
.
+
+
+
+ note
+ Discretionary
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ option
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.
+
+
+
+ paragraph
+ Prohibited
+
+
+
+
+
+ presentation
+ Prohibited
+
+ An element with
+ role="presentation"
is not part of the accessibility tree (except in error cases).
+ Do not use aria-labelledby
or aria-label
.
+
+
+
+
+ progressbar
+ Required
+
+
+
+
+ progressbar
role is applied to an HTML progress
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ radio
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.type="checkbox"
, use a label
element.aria-labelledby
.
+
+
+
+ radiogroup
+ Required
+
+
+
+
+ radio
buttons.aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ region
+ Required
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ row
+ Required Only If Content Insufficient AND descendant of a
+ treegrid
AND the row is focusable
+ When
+ row
elements are focusable in a treegrid, screen readers announce the entire contents of a row when navigating by row.
+ This is typically the most appropriate behavior.
+ However, in some circumstances, it could be beneficial to change the order in which cells are announced or exclude announcement of certain cells by using aria-labelledby
to specify which cells to announce.
+
+
+
+
+ rowgroup
+ Do Not Name
+ Naming is not supported by assistive technologies.
+
+
+
+
+ rowheader
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.rowheader
role is implied from an HTML th
, the HTML abbr
attribute can be used to specify an abbreviated version of the name that is only announced when screen readers are reading an associated cell
within the table
, grid
, or treegrid
.
+
+
+
+ scrollbar
+ Discretionary
+
+
+
+
+ aria-controls
attribute, which is required for scrollbar
.
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ search
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ searchbox
+ Required
+
+
+
+
+ searchbox
role is applied to an HTML input
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ separator
+ Discretionary
+
+
+
+
+ separator
element on the page.aria-labelledby
if a visible label is present, otherwise with aria-label
.
+
+
+
+ slider
+ Required
+
+
+
+
+ slider
role is applied to an HTML input
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ spinbutton
+ Required
+
+
+
+
+ textbox
role is applied to an HTML input
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ status
+ Discretionary
+
+ Some screen readers announce the name of a status element before announcing the content of the status element.
+ Thus,
+ aria-label
provides a method for prefacing the visible content of a status element with text that is not displayed as part of the status element.
+ Using aria-label
is functionally equivalent to providing off-screen text in the contents of the status element, except off-screen text would be announced by screen readers that do not support aria-label
on status
elements.
+
+
+
+
+ strong
+ Prohibited
+
+
+
+
+
+ subscript
+ Prohibited
+
+
+
+
+
+ superscript
+ Prohibited
+
+
+
+
+
+ switch
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.type="checkbox"
, use a label
element.aria-labelledby
.
+
+
+
+ tab
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.
+
+
+
+ table
+ Required
+
+
+
+
+ table
element, use the caption
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ tablist
+ Recommended
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ tabpanel
+ Required
+
+
+
+
+ aria-labelledby
pointing to the tab
element that controls the tabpanel
.
+
+
+
+ term
+ Do Not Name
+ Since a term is usually the name for the
+ role="definition"
element, it could be confusing if the term itself also has a name.
+
+
+
+ textbox
+ Required
+
+
+
+
+ textbox
role is applied to an HTML input
or textarea
element, can be named with an HTML label
element.aria-labelledby
if a visible label is present.aria-label
if a visible label is not present.
+
+
+
+ time
+ Do Not Name
+ Naming is not supported by assistive technologies.
+
+
+
+
+ timer
+ Discretionary
+
+ Some screen readers announce the name of a timer element before announcing the content of the timer element.
+ Thus,
+ aria-label
provides a method for prefacing the visible content of a timer element with text that is not displayed as part of the timer element.
+ Using aria-label
is functionally equivalent to providing off-screen text in the contents of the timer element, except off-screen text would be announced by screen readers that do not support aria-label
on timer
elements.
+
+
+
+
+ toolbar
+ Recommended
+
+
+
+
+ toolbar
element on the page, naming is required.aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ tooltip
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide descendant content from assistive technologies.
+
+
+
+ tree
+ Required
+
+
+
+
+ aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+ treegrid
+ Required
+
+
+
+
+ treegrid
is applied to an HTML table
element, then the accessible name can be derived from the table's caption
element.aria-labelledby
if a visible label is present, otherwise use aria-label
.
+
+
+
+
+ treeitem
+ Required Only If Content Insufficient
+
+
+
+
+ aria-label
or aria-labelledby
will hide any descendant content from assistive technologies.group
is automatically excluded from the accessible name calculation.Accessible name calculation
+
+
+ aria-labelledby
property is used if present.aria-label
property is used if present.
+
+ input
whose type
attribute is in the Button, Submit Button, or Reset Button statevalue
attribute.input
whose type
attribute is in the Image Button stateimg
area
alt
attribute.fieldset
legend
element.label
element(s).figure
figcaption
element.table
caption
element.
+
+ input
whose type
attribute is in the Text, Password, Search, Telephone, or URL statestextarea
title
attribute.
+ Otherwise, the placeholder
attribute.
+ input
whose type
attribute is in the Submit Button stateinput
whose type
attribute is in the Reset Button stateinput
whose type
attribute is in the Image Button statetitle
attribute.
+ Otherwise, a localized string of the phrase "Submit Query".
+ summary
title
attribute.treeitem
and menuitem
as described below.
+ And, when following references in an aria-labelledby
attribute, it similarly walks the tree of each referenced element.
+ Thus, the naming algorithm is recursive.
+ The following two sections explain non-recursive and recursive examples of how the algorithm works.
+ treeitem
role, descendant content of child group
elements are not included.
+ For example, in the following tree
, the name of the first tree item is Fruits
; Apples
, Bananas
, and Oranges
are automatically omitted.
+
+ <ul role="tree">
+ <li role="treeitem">Fruits
+ <ul role="group">
+ <li role="treeitem">Apples</li>
+ <li role="treeitem">Bananas</li>
+ <li role="treeitem">Oranges</li>
+ </ul>
+ </li>
+</ul>
menuitem
role, descendant content of child menu
elements are not included.
+ So, the name of the first parent menuitem
in the following menu
is Fruits
.
+
+
+ <ul role="menu">
+ <li role="menuitem">Fruits
+ <ul role="menu">
+ <li role="menuitem">Apples</li>
+ <li role="menuitem">Bananas</li>
+ <li role="menuitem">Oranges</li>
+ </ul>
+ </li>
+</ul>
Examples of non-recursive accessible name calculation
+ input
element that has no associated label
element and only a name
attribute and so does not have an accessible name (do not do this):
+ <input name="code">
placeholder
attribute, then it serves as a naming fallback mechanism (avoid doing this):
+
+ <input name="code"
+ placeholder="One-time code">
title
attribute, then it is used as the accessible name instead of placeholder
, but it is still a fallback (avoid doing this):
+
+ <input name="code"
+ placeholder="123456"
+ title="One-time code">
label
element (recommended), then that is used as the accessible name, and the title
attribute is instead used as the accessible description:
+
+ <label>One-time code
+ <input name="code"
+ placeholder="123456"
+ title="Get your code from the app.">
+</label>
aria-label
attribute (not recommended unless it adds clarity for assistive technology users), then that becomes the accessible name, overriding the label
element:
+
+ <label>Code
+ <input name="code"
+ aria-label="One-time code"
+ placeholder="123456"
+ title="Get your code from the app.">
+</label>
aria-labelledby
attribute, that wins over the other elements and attributes (the aria-label
attribute ought to be removed if it is not used):
+ <p>Please fill in your <span id="code-label">one-time code</span> to log in.</p>
+<p>
+ <label>Code
+ <input name="code"
+ aria-labelledby="code-label"
+ aria-label="This is ignored"
+ placeholder="123456"
+ title="Get your code from the app.">
+ </label>
+</p>
Examples of recursive accessible name calculation
+ aria-labelledby
reference causes the algorithm to be invoked recursively, and when computing an accessible name from content the algorithm is invoked recursively for each child node.
+ Move to trash
.
+ <button>Move to <img src="bin.svg" alt="trash"></button>
aria-labelledby
reference, the algorithm avoids following the same reference twice to avoid infinite loops.aria-labelledby
reference to the parent element, and then computing the label for that element from the child nodes, first visiting the button
element again but ignoring the aria-labelledby
reference and instead using the aria-label
, and then visiting the next child (the text node).
+ The resulting label is Remove meeting: Daily status report
.
+
+ <div id="meeting-1">
+ <button aria-labelledby="meeting-1" aria-label="Remove meeting:">X</button>
+ Daily status report
+</div>
Describing Techniques
+ Describing by referencing content with
+ aria-describedby
aria-describedby
property works similarly to the aria-labelledby
property.
+ For example, a button could be described by a sibling paragraph.
+
+ <button aria-describedby="trash-desc">Move to trash</button>
+...
+<p id="trash-desc">Items in the trash will be permanently removed after 30 days.</p>
img
element, a text equivalent of the image is computed.
+
+ <button aria-describedby="trash-desc">Move to <img src="bin.svg" alt="trash"></button>
+...
+<p id="trash-desc">Items in <img src="bin.svg" alt="the trash"> will be permanently removed after 30 days.</p>
aria-labelledby
, it is possible to reference an element using aria-describedby
even if that element is hidden.
+ For example, a text field in a form could have a description that is hidden by default, but can be revealed on request using a disclosure widget.
+ The description could also be referenced from the text field directly with aria-describedby
.
+ In the following example, the accessible description for the input
element is Your username is the name that you use to log in to this service.
+
+ <label for="username">Username</label>
+<input id="username" name="username" aria-describedby="username-desc">
+<button aria-expanded="false" aria-controls="username-desc" aria-label="Help about username">?</button>
+<p id="username-desc" hidden>
+ Your username is the name that you use to log in to this service.
+</p>
Describing Tables and Figures with Captions
+ table
is named using aria-label
or aria-labelledby
, a child caption
element becomes an accessible description.
+ For example, a preceding heading might serve as an appropriate accessible name, and the caption
element might contain a longer description.
+ In such a situation, aria-labelledby
could be used on the table
to set the accessible name to the heading content and the caption
would become the accessible description.
+
+ <h2 id="events-heading">Upcoming events</h2>
+<table aria-labelledby="events-heading">
+ <caption>
+ Calendar of upcoming events, weeks 27 through 31, with each week starting with
+ Monday. The first column is the week number.
+ </caption>
+ <tr><th>Week</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th><th>Sunday</th></tr>
+ <tr><td>27</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
+ <tr><td>28</td><td></td><td></td><td></td><td></td><td></td><td></td><td><a href="/events/9856">Crown Princess's birthday</a></td></tr>
+ <tr><td>29</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
+ <tr><td>30</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
+ <tr><td>31</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
+</table>
figure
element can get its accessible name from its figcaption
element, but it will not be used as the accessible description, even if it was not used as the accessible name.
+ If the figcaption
element is appropriate as an accessible description, and the accessible name is set using aria-labelledby
or aria-label
, then the figcaption
can be explicitly set as the accessible description using the aria-describedby
attribute.
+
+ <h2 id="neutron">Neutron</h2>
+<figure aria-labelledby="neutron" aria-describedby="neutron-caption">
+ <img src="neutron.svg" alt="Within the neutron are three quarks (blue 'u', red 'd', green 'd') that are interconnected.">
+ <figcaption id="neutron-caption">
+ The quark content of the neutron. The color assignment of individual quarks is
+ arbitrary, but all three colors must be present. Forces between quarks are
+ mediated by gluons.
+ </figcaption>
+</figure>
Descriptions Derived from Titles
+ aria-describedby
attribute or one of the primary host-language-specific attributes or elements (e.g., the caption
element for table
), then, for HTML, if the element has a title
attribute, that is used as the accessible description.aria-describedby
is generally recommended.
+ If a description that is not visible is desired, then the title
attribute can be used, for any HTML element that can have an accessible description.
+ title
attribute might not be accessible to some users, in particular sighted users not using a screen reader and not using a pointing device that supports hover (e.g., a mouse).input
element with input constrained using the pattern
attribute can use the title
attribute to describe what the expected input is.
+ <label> Part number:
+ <input pattern="[0-9][A-Z]{3}" name="part"
+ title="A part number is a digit followed by three uppercase letters."/>
+</label>
title
attribute in this case can be shown to the user as a tooltip when the user hovers or focuses the control, but also as part of the error message when the user agent validates the form, if the input
element's value doesn't match the pattern
.title
attribute to describe the link in more detail.
+ <a href="http://twitter.com/W3C"
+ title="Follow W3C on Twitter">
+ <img src="/2008/site/images/Twitter_bird_logo_2012.svg"
+ alt="Twitter" class="social-icon" height="40" />
+</a>
Accessible description calculation
+ aria-describedby
instead of aria-labelledby
.
+
+
+ aria-describedby
property is used if present.
+
+ input
whose type
attribute is in the Button, Submit Button, or Reset Button statevalue
attribute.summary
table
caption
element.title
attribute.
+ Communicating Value and Limits for Range Widgets
+
+ Introduction
+
+
+ meter
progressbar
scrollbar
separator
(if focusable)slider
spinbutton
+
+
+
+
+
+
+ Property
+ Definition
+
+
+
+ aria-valuemin
Defines the minimum value allowed by a range widget.
+
+
+
+ aria-valuemax
Defines the maximum value allowed by a range widget.
+
+
+
+ aria-valuenow
+ Defines the current value of a range widget.
+ This value is a number greater than or equal to
+ aria-valuemin
and less than or equal to aria-valuemax
(if they are specified).
+
+
+
+
+ aria-valuetext
If a numeric value is not sufficiently descriptive, this property can define a text description of the current value of a range widget.
+ Read Me First
+ No ARIA is better than Bad ARIA
+ Principle 1: A role is a promise
+
+ <div role="button">Place Order</div>
<div>
has also incorporated JavaScript that provides the keyboard interactions expected for a button.
+ Unlike HTML input elements, ARIA roles do not cause browsers to provide keyboard behaviors or styling.
+ Principle 2: ARIA Can Both Cloak and Enhance, Creating Both Power and Danger
+
+ <a role="menuitem">Assistive tech users perceive this element as an item in a menu, not a link.</a>
+ <a aria-label="Assistive tech users can only perceive the contents of this aria-label, not the link text">Link Text</a>
+ <button aria-pressed="false">Mute</button>
+ <table role="log">
+ <!--
+ Table that assistive technology users will not perceive as a table.
+ The log role tells browser this is a log, not a table.
+ -->
+</table>
+<ul role="navigation">
+ <!-- This is a navigation region, not a list. -->
+ <li><a href="uri1">nav link 1</li>
+ <li><a href="uri2">nav link 2</li>
+ <!-- ERROR! Previous list items are not in a list! -->
+</ul>
Browser and Assistive Technology Support
+ Mobile and Touch Support
+ Structural Roles
+
+ Introduction
+ <p>
element is mapped to accessibility APIs in exactly the same way as <div role="paragraph">
.
+ The ARIA and HTML specifications refer to this mapping of HTML elements to ARIA attributes as implied semantics, i.e., the implied ARIA role of the HTML <p>
element is paragraph
.
+ When to Use Structural Roles
+
+
+ All Structural Roles and Their HTML Equivalents
+
+
+
+
+
+
+ ARIA Role
+ HTML Equivalent
+
+
+ application
+ No equivalent element
+
+
+ article
+ article
+
+
+ blockquote
+ blockquote
+
+
+ caption
+ caption
+
+
+ cell
+ td
+
+
+ code
+ code
+
+
+ columnheader
+ th
+
+
+ definition
+ dd
+
+
+ deletion
+ del
+
+
+ directory
+ No equivalent element
+
+
+ document
+ No equivalent element
+
+
+ emphasis
+ em
+
+
+ feed
+ No equivalent element
+
+
+ figure
+ figure
+
+
+ generic
+ div, span
+
+
+ group
+ No equivalent element
+
+
+ heading with aria-level="N" where N is 1, 2, 3, 4, 5, or 6
+ h1, h2, h3, h4, h5, h6
+
+
+ insertion
+ ins
+
+
+ img
+ img
+
+
+ list
+ ul, ol
+
+
+ listitem
+ li
+
+
+ math
+ No equivalent element
+
+
+ none
+ No equivalent element
+
+
+ note
+ No equivalent element
+
+
+ presentation
+ No equivalent element
+
+
+ paragraph
+ p
+
+
+ row
+ tr
+
+
+ rowgroup
+ tbody, thead, tfoot
+
+
+ rowheader
+ th
+
+
+ separator (when not focusable)
+ hr
+
+
+ strong
+ strong
+
+
+ subscript
+ sub
+
+
+ superscript
+ sup
+
+
+ table
+ table
+
+
+ term
+ dfn
+
+
+ time
+ time
+
+
+ toolbar
+ No equivalent element
+
+
+
+ tooltip
+ No equivalent element
+
+
+
+
+ ARIA Roles, Properties and States Referenced in Guidance and Examples
-
- h2
-h6
) or through the use of
- data-aria-roles
or data-aria-props
attributes on any heading within the practices. The data-aria-roles
or data-aria-props
attributes should contain a space separated list of values. The use of the data attribute overrides the identification of roles, properties or states from the text content of a heading. The suffix "(D)" indicates a reference came from a data attribute, otherwise the reference came from the text content of a heading.
-
-
- CSV Files of Role, Properties and States Coverage
-
- Roles with No Guidance or Examples (30)
-
-
- application
caption
code
definition
deletion
directory
document
emphasis
figure
generic
heading
img
input
insertion
list
listitem
log
marquee
math
note
paragraph
progressbar
rowheader
scrollbar
searchbox
status
switch
term
textbox
timer
Roles with at Least One Guidance or Example (13)
-
-
-
-
-
-
-
- Role
- Guidance
- Example
-
-
-
- alertdialog
- Alert Dialog
-
-
-
-
- article
- Feed
-
-
-
-
- columnheader
- Table
-
-
-
-
- complementary
Complementary
-
- Complementary Landmark
-
-
-
-
- feed
Feed
-
- Feed
-
-
-
-
- link
Link
-
- Link
-
-
-
-
- main
Main
-
- Main Landmark
-
-
-
-
- menuitemcheckbox
- Editor Menubar
-
-
-
-
- rowgroup
- Table
-
-
-
-
- search
Search
-
- Search Landmark
-
-
-
-
- separator
- Editor Menubar
-
-
-
-
- tooltip
Tooltip Widget
-
-
-
-
-
- treegrid
Treegrid
-
- Treegrid Email Inbox
-
- Roles with More than One Guidance or Example (35)
- Properties and States with No Guidance or Examples (12)
-
-
- aria-details
aria-dropeffect
aria-errormessage
aria-flowto
aria-grabbed
aria-invalid
aria-keyshortcuts
aria-multiline
aria-placeholder
aria-readonly
aria-relevant
aria-required
Properties and States with at Least One Guidance or Example (9)
-
-
-
-
-
-
-
- Property or State
- Guidance
- Example
-
-
-
- aria-atomic
- Alert
-
-
-
-
- aria-busy
- Feed
-
-
-
-
- aria-colcount
Using aria-colcount and aria-colindex
-
- Data Grid
-
-
-
-
- aria-colspan
Defining cell spans using aria-colspan and aria-rowspan
-
-
-
-
-
- aria-multiselectable
- Listboxes with Rearrangeable Options
-
-
-
-
- aria-orientation
- Slider with aria-orientation and aria-valuetext
-
-
-
-
- aria-owns
- Navigation Treeview
-
-
-
-
- aria-rowspan
Defining cell spans using aria-colspan and aria-rowspan
-
-
-
-
-
- aria-sort
Indicating sort order with aria-sort
-
- Data Grid
-
- Properties and States with More than One Guidance or Example (27)
- Example Coding Practices
-
- Coding Summary
-
-
-
-
-
-
- Total Examples
- 52
-
-
- High Contrast Documentation
- 17
-
-
- Uses SVG
- 22
-
-
- Uses
- forced-color-adjust
on SVG1
-
-
- Uses
- event.KeyCode
28
-
-
- Uses
- event.which
12
-
-
- Use Class
- 12
-
-
- Use Prototype
- 33
-
-
- Mouse Events
- 23
-
-
-
- Pointer Events
- 1
- Coding Practices
-
-
-
-
-
-
-
-
- Example
- Created Using
- Uses
- event.keyCode
Uses
- event.which
High Contrast Documentation
- Example Code ID
- Roles in Javascript and HTML
- Roles in Documentation
- aria-* Attributes in Javascript and HTML
- aria-* Attributes in Documentation
- Differences between the documentation and the source code.
-
-
- Accordion
- prototype
-
- Yes
-
- coding-arena
- 1
- 1
- 6
- 4
- aria-hidden,aria-required
-
-
- Alert
-
-
-
-
- ex1
- 1
- 1
- 0
- 2
- aria-live,aria-atomic
-
-
- Button (IDL Version)
-
- Yes
-
-
- example
- 1
- 1
- 2
- 2
-
-
-
- Button
-
- Yes
-
-
- example
- 1
- 1
- 2
- 1
- aria-hidden
-
-
- Auto-Rotating Image Carousel with Buttons for Slide Control
- prototype
-
-
-
- ex1
- 2
- 2
- 4
- 4
-
-
-
- Auto-Rotating Image Carousel with Tabs for Slide Control
- prototype
-
-
- Yes
- ex1
- 4
- 4
- 5
- 5
-
-
-
- Checkbox (Two State)
- prototype
- Yes
-
- Yes
- ex1
- 2
- 2
- 2
- 1
- aria-labelledby
-
-
- Checkbox (Mixed-State)
- prototype
- Yes
-
- Yes
- ex1
- 1
- 1
- 2
- 2
-
-
-
- Editable Combobox With Both List and Inline Autocomplete
- class
-
-
-
- ex1
- 3
- 3
- 7
- 6
- aria-hidden
-
-
- Editable Combobox With List Autocomplete
- class
-
-
-
- ex1
- 3
- 3
- 7
- 6
- aria-hidden
-
-
- Editable Combobox without Autocomplete
- class
-
-
-
- ex1
- 3
- 3
- 7
- 6
- aria-hidden
-
-
- Date Picker Combobox
- class
-
-
- Yes
- ex1
- 4
- 3
- 11
- 10
- gridcell,aria-hidden
-
-
- Select-Only Combobox
- prototype
-
-
-
- ex1
- 2
- 3
- 6
- 5
- option,aria-haspopup
-
-
- Editable Combobox with Grid Popup
- prototype
- Yes
- Yes
-
- ex1
- 2
- 4
- 7
- 7
- row,gridcell
-
-
- Alert Dialog
- prototype
- Yes
- Yes
-
- ex_alertdialog
- 2
- 2
- 4
- 3
- aria-controls
-
-
- Date Picker Dialog
- prototype
-
-
- Yes
- example
- 3
- 2
- 6
- 6
- gridcell
-
-
- Modal Dialog
- prototype
- Yes
- Yes
-
- ex1
- 1
- 1
- 3
- 3
-
-
-
- Disclosure (Show/Hide) for Answers to Frequently Asked Questions
- prototype
- Yes
-
- Yes
- ex1
- 0
- 0
- 2
- 2
-
-
-
- Disclosure (Show/Hide) for Image Description
- prototype
- Yes
-
- Yes
- ex1
- 0
- 0
- 3
- 2
- aria-labelledby
-
-
- Disclosure Navigation Menu with Top-Level Links
- class, prototype
-
-
-
- ex1
- 4
- 0
- 5
- 3
- banner,contentinfo,navigation,region,aria-label,aria-labelledby
-
-
- Disclosure Navigation Menu
- class, prototype
-
-
- Yes
- ex1
- 2
- 0
- 4
- 3
- navigation,region,aria-label
-
-
- Feed
-
-
-
-
- ex1
- 0
- 2
- 0
- 5
- feed,article,aria-labelledby,aria-busy,aria-describedby,aria-posinset,aria-setsize
-
-
- Feed Display
- prototype
- Yes
- Yes
-
- not found
- 0
- 0
- 6
- 0
- aria-busy,aria-describedby,aria-label,aria-labelledby,aria-posinset,aria-setsize
-
-
- Advanced Data Grid
- prototype
- Yes
- Yes
-
- ex1
- 0
- 0
- 5
- 0
- aria-colindex,aria-controls,aria-haspopup,aria-rowindex,aria-sort
-
-
- Data Grid
- prototype
- Yes
- Yes
-
- ex1
- 4
- 1
- 8
- 6
- button,menu,menuitem,aria-controls,aria-haspopup
-
-
- Layout Grid
- prototype
- Yes
- Yes
-
- ex1
- 5
- 3
- 9
- 3
- button,region,aria-colindex,aria-haspopup,aria-label,aria-live,aria-relevant,aria-sort
-
-
- Link
-
- Yes
-
-
- not found
- 1
- 1
- 1
- 1
-
-
-
- Collapsible Dropdown Listbox
- prototype
- Yes
- Yes
-
- ex
- 2
- 2
- 8
- 5
- aria-disabled,aria-keyshortcuts,aria-multiselectable
-
-
- Listbox with Grouped Options
- prototype
- Yes
- Yes
-
- ex
- 4
- 3
- 6
- 3
- presentation,aria-disabled,aria-keyshortcuts,aria-multiselectable
-
-
- Listboxes with Rearrangeable Options
- prototype
- Yes
- Yes
-
- ex1
- 3
- 2
- 8
- 4
- toolbar,aria-disabled,aria-keyshortcuts,aria-label,aria-live
-
-
- Scrollable Listbox
- prototype
- Yes
- Yes
-
- ex
- 2
- 2
- 6
- 3
- aria-disabled,aria-keyshortcuts,aria-multiselectable
-
-
- Actions Menu Button Using aria-activedescendant
- class
-
-
- Yes
- ex1
- 2
- 2
- 5
- 5
-
-
-
- Actions Menu Button Using element.focus()
- class
-
-
- Yes
- ex1
- 2
- 2
- 4
- 4
-
-
-
- Navigation Menu Button
- class
-
-
- Yes
- ex1
- 3
- 3
- 4
- 4
-
-
-
- Editor Menubar
- prototype
-
-
- Yes
- ex1
- 8
- 7
- 6
- 5
- none,aria-orientation
-
-
- Navigation Menubar
- class
-
-
- Yes
- ex1
- 9
- 8
- 6
- 5
- separator,aria-orientation
-
-
- Meter
- prototype
-
-
-
- example
- 1
- 1
- 5
- 4
- aria-hidden
-
-
- Radio Group Using aria-activedescendant
- prototype
-
-
- Yes
- ex1
- 2
- 2
- 3
- 3
-
-
-
- Radio Group Using Roving tabindex
- prototype
-
-
- Yes
- ex1
- 2
- 2
- 2
- 2
-
-
-
- Horizontal Multi-Thumb Slider
- prototype
- Yes
-
-
- ex1
- 1
- 1
- 5
- 5
-
-
-
- Slider with aria-orientation and aria-valuetext
- prototype
- Yes
-
-
- ex1
- 1
- 1
- 6
- 6
-
-
-
- Color Viewer Slider
- class
-
-
- Yes
- ex1
- 2
- 2
- 5
- 5
-
-
-
- Date Picker Spin Button
- prototype
- Yes
-
-
- example
- 2
- 2
- 7
- 7
-
-
-
- Table
-
-
-
-
- ex1
- 5
- 5
- 2
- 2
-
-
-
- Tabs with Automatic Activation
-
- Yes
-
-
- ex1
- 3
- 3
- 5
- 4
- aria-orientation
-
-
- Tabs with Manual Activation
-
- Yes
-
-
- ex1
- 3
- 3
- 5
- 4
- aria-orientation
-
-
- Toolbar
-
-
-
-
- not found
- 0
- 0
- 0
- 0
-
-
-
- Toolbar
- prototype
- Yes
-
-
- ex1
- 6
- 6
- 12
- 12
-
-
-
- Treegrid Email Inbox
- prototype
- Yes
-
-
- ex1
- 3
- 3
- 7
- 5
- aria-activedescendant,aria-current
-
-
- File Directory Treeview Using Computed Properties
- prototype
- Yes
-
-
- ex1
- 3
- 3
- 3
- 2
- aria-label
-
-
- File Directory Treeview Using Declared Properties
- prototype
- Yes
-
-
- ex1
- 3
- 3
- 6
- 5
- aria-label
-
-
- Navigation Treeview
- class
- Yes
-
- Yes
- ex1
- 8
- 8
- 5
- 5
-
- Graphics Techniques
-
-
-
-
-
-
-
-
- Example
- SVG in HTML
- SVG in CSS
- SVG in JS
-
- forced-color-adjust
CSS ::before
- CSS ::after
- CSS content
-
-
- Button (IDL Version)
- Yes
- Yes
-
-
- Yes
-
- Yes
-
-
- Button
- Yes
- Yes
-
-
- Yes
-
- Yes
-
-
- Auto-Rotating Image Carousel with Buttons for Slide Control
- Yes
- Yes
-
-
-
-
-
-
-
- Auto-Rotating Image Carousel with Tabs for Slide Control
- Yes
- Yes
-
-
-
-
-
-
-
- Checkbox (Two State)
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Checkbox (Mixed-State)
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Editable Combobox With Both List and Inline Autocomplete
- Yes
- Yes
-
-
-
-
-
-
-
- Editable Combobox With List Autocomplete
- Yes
- Yes
-
-
-
-
-
-
-
- Editable Combobox without Autocomplete
- Yes
- Yes
-
-
-
-
-
-
-
- Date Picker Combobox
- Yes
- Yes
-
-
-
-
- Yes
-
-
- Select-Only Combobox
-
-
-
-
-
- Yes
- Yes
-
-
- Date Picker Dialog
-
-
-
-
-
-
- Yes
-
-
- Disclosure (Show/Hide) for Answers to Frequently Asked Questions
-
- Yes
-
-
-
-
- Yes
-
-
- Disclosure (Show/Hide) for Image Description
-
- Yes
-
-
-
-
- Yes
-
-
- Disclosure Navigation Menu with Top-Level Links
-
-
-
-
-
- Yes
- Yes
-
-
- Disclosure Navigation Menu
-
-
-
-
-
- Yes
- Yes
-
-
- Feed Display
-
-
-
-
-
-
- Yes
-
-
- Advanced Data Grid
-
-
-
-
-
- Yes
- Yes
-
-
- Data Grid
-
-
-
-
-
- Yes
- Yes
-
-
- Layout Grid
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Link
-
- Yes
-
-
- Yes
-
- Yes
-
-
- Collapsible Dropdown Listbox
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Listbox with Grouped Options
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Listboxes with Rearrangeable Options
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Scrollable Listbox
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Actions Menu Button Using aria-activedescendant
- Yes
- Yes
-
-
-
-
-
-
-
- Actions Menu Button Using element.focus()
- Yes
- Yes
-
-
-
-
-
-
-
- Navigation Menu Button
- Yes
- Yes
-
-
-
-
-
-
-
- Editor Menubar
-
- Yes
-
-
- Yes
- Yes
- Yes
-
-
- Navigation Menubar
- Yes
- Yes
- Yes
-
-
-
-
-
-
- Meter
- Yes
-
-
-
-
-
-
-
-
- Radio Group Using aria-activedescendant
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Radio Group Using Roving tabindex
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Color Viewer Slider
- Yes
- Yes
- Yes
- Yes
-
-
-
-
-
- Date Picker Spin Button
- Yes
- Yes
-
-
-
-
-
-
-
- Tabs with Automatic Activation
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Tabs with Manual Activation
-
-
-
-
- Yes
- Yes
- Yes
-
-
- Toolbar
- Yes
- Yes
-
-
- Yes
- Yes
- Yes
-
-
- Treegrid Email Inbox
-
- Yes
-
-
- Yes
-
- Yes
-
-
- File Directory Treeview Using Computed Properties
-
-
-
-
- Yes
-
- Yes
-
-
- File Directory Treeview Using Declared Properties
-
-
-
-
- Yes
-
- Yes
-
-
- Navigation Treeview
- Yes
- Yes
-
-
-
-
-
- Mouse and Pointer Events
- Accordion Example
- Example
-
-
-
-
-
-
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Space or Enter
- When focus is on the accordion header of a collapsed section, expands the section.
-
-
- Tab
-
-
-
-
-
-
-
- Shift + Tab
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- h3
-
-
-
-
-
-
-
- aria-expanded="true"
- button
- Set to
- true
when the Accordion panel is expanded, otherwise set to false
.
-
-
-
-
- aria-controls="ID"
- button
- Points to the ID of the panel which the header controls.
-
-
-
-
- region
-
- div
Creates a landmark region that contains the currently expanded accordion panel.
-
-
-
-
-
- aria-labelledby="IDREF"
- div
-
-
-
- region
element.region
elements are required to have an accessible name to be identified as a landmark.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Alert Example
- Trigger Alert
button causes a message to be inserted into the example alert element.
-
-
- Example
- Accessibility Features
- Keyboard Support
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- alert
-
- div
Identifies the element as the container where alert content will be added or updated.
-
-
-
-
- aria-live=
assertive
Implicit on
- div
-
-
-
-
-
-
-
-
- aria-atomic=
true
Implicit on
- div
-
-
-
- Javascript and CSS Source Code
-
- HTML Source Code
-
-
-
-
- Breadcrumb Example
- Example
-
-
- Accessibility Features
-
-
- nav
element labeled Breadcrumb
identifies the structure as a breadcrumb trail and makes it a navigation landmark so that it is easy to locate.
-
- nav
element with its label of Breadcrumb
.
- So, using a display technique that is not represented in the accessibility tree used by screen readers prevents redundant and potentially distracting verbosity.
- transform
property so it resembles a slash.Keyboard Support
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-label=
- Breadcrumb
-
- nav
-
- Provides a label that describes the type of navigation provided in the
- nav
element.
-
-
-
-
-
-
- aria-current=
- page
-
- a
-
- Applied to the last link in the set to indicate that it represents the current page.
-
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Button Examples
-
-
-
-
- element.focus()
: A button that opens a menu of actions or commands where focus in the menu is managed using element.focus()
.aria-activedescendant
: A button that opens a menu of actions or commands where focus in the menu is managed using aria-activedescendant
.Example
- Print
action button uses a div
element.Mute
toggle button uses an a
element.Keyboard Support
-
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
- Activates the button.
-
-
-
- Space
- Activates the button.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- button
-
-
- div
, a
-
-
-
-
- button
widget.
-
-
-
-
- tabindex="0"
-
-
- div
, a
-
-
-
-
- a
element because it does not have a href
attribute.
-
-
-
- aria-pressed="false"
- a
-
-
-
-
-
-
-
-
- aria-pressed="true"
- a
-
-
-
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
-
-
-
-
- Button Examples (IDL Version)
- role
and ariaPressed
attributes are accessed using dot notation instead of setAttribute()
and getAttribute()
.
- In all other respects, these examples are identical to the Button Examples.
- Example
- Print
action button uses a div
element.Mute
toggle button uses an a
element.Keyboard Support
-
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
- Activates the button.
-
-
-
- Space
- Activates the button.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- button
-
-
- div
, a
-
-
-
-
- element.role = 'button';
.button
widget.
-
-
-
-
- tabindex="0"
-
-
- div
, a
-
-
-
-
- a
element because it does not have a href
attribute.
-
-
-
- aria-pressed="false"
- a
-
-
-
- button.ariaPressed = 'false';
.
-
-
-
- aria-pressed="true"
- a
-
-
-
- button.ariaPressed = 'true';
.
-
-
-
-
- aria-hidden="true"
- svg
Excludes SVG from accessible name calculation for the button.
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
-
-
-
-
- Auto-Rotating Image Carousel Example with Buttons for Slide Control
-
-
-
- Example Options
-
-
-
- Example
-
-
-
-
- Dynamic Europe: Amsterdam, Prague, Berlin
-
-
-
-
-
-
-
-
- Travel to Southwest England and Paris
-
-
-
-
-
-
-
- Great Children's Programming on Public TV
-
-
-
-
-
-
-
- Foyle’s War Revisited
-
-
-
-
-
-
-
- Great Britain Vote: 7 pm Sat.
-
-
-
-
-
-
-
- Mid-American Gardener: Thursdays at 7 pm
-
-
-
-
- Accessibility Features
- Controlling Automatic Slide Rotation
-
-
-
-
- Color Contrast of Text and Rotation Controls
-
-
-
- Screen Reader Announcement of Slide Changes
- Keyboard Support
- Rotation Control Button
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
-
-
-
-
-
-
-
- Enter or Space
- Toggle the auto rotation of slides in the carousel.
- Next and Previous Slide Buttons
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Enter
-
Space
- Display next or previous slide in the carousel.
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- region
-
-
-
- section
-
-
-
-
- region
is implied for any section
element that has an accessible name.
-
-
-
-
- aria-roledescription="carousel"
-
-
- section
-
-
-
-
-
-
-
-
-
- aria-label="Highlighted television shows"
-
-
- section
- Provides a label that describes the content in the carousel region.
-
-
-
-
-
- aria-live="off"
-
-
- div.carousel-items
-
-
-
-
- div
element that contains all the slides.
-
-
-
-
- aria-live="polite"
-
-
- div.carousel-items
-
-
-
-
- div
element that contains all the slides.
-
-
-
- group
-
-
-
- div.carousel-item
-
-
-
-
-
-
-
-
-
- aria-roledescription="slide"
-
-
- div.carousel-item
-
-
-
-
- group
elements.
-
-
-
-
- aria-label="N of 6"
-
-
- div.carousel-item
-
-
-
-
- aria-setsize
or aria-posinset
.
-
-
-
-
- aria-label="LABEL_STRING"
-
-
- button
- Defines the accessible name for the pause auto-rotation button and the next and previous slide buttons.
-
-
-
-
-
-
- aria-controls="IDREF"
-
-
- button
-
-
-
-
- div
that contains all the slides.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Checkbox Example (Mixed-State)
-
-
- Example
- Accessibility Features
-
-
- Sandwich Condiments
, the checkboxes are wrapped in a fieldset
element which is labeled by a legend
element.currentcolor
value for the stroke
property of the rect
and polyline
elements used to draw the checkbox.
- To make the background of the checkbox graphics match the high contrast background color, the fill-opacity
attribute of the rect
element is set to zero.
- If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the checkbox and the background or even make the checkbox invisible if the color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
- Moves keyboard focus among the checkboxes.
-
-
-
- Space
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- checkbox
-
- div
-
-
-
- div
element as a checkbox
.div
provides the accessible name of the checkbox.
-
-
-
- tabindex="0"
- div
Includes the checkbox in the page tab sequence.
-
-
-
-
- aria-controls="[IDREFS]"
- div
identifies the set of checkboxes controlled by the mixed checkbox.
-
-
-
-
- aria-checked="false"
- div
-
-
-
- checkbox
is not checked.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo element and content
property are used to generate the visual indicators of the checkbox state.
-
-
-
- aria-checked="true"
- div
-
-
-
- checkbox
is checked.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo element and content
property are used to generate the visual indicators of the checkbox state.
-
-
-
-
- aria-checked="mixed"
- div
-
-
-
- checkbox
is mixed.[aria-checked="mixed"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo element and content
property are used to generate the visual indicators of the checkbox state.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Checkbox Example (Two State)
- div
elements.
-
-
- fieldset
.Example
- Sandwich Condiments
-
-
- Accessibility Features
-
-
- Sandwich Condiments
, the checkboxes are wrapped in a group
labeled by the h3
heading element.div
element that serves as a checkbox is contained within a li
element contained by a ul
element.currentcolor
value for the stroke
property of the rect
and polyline
elements used to draw the checkbox.
- To make the background of the checkbox graphics match the high contrast background color, the fill-opacity
attribute of the rect
element is set to zero.
- If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the checkbox and the background or even make the checkbox invisible if the color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
- Moves keyboard focus to the
- checkbox
.
-
-
- Space
- Toggles checkbox between checked and unchecked states.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- h3
-
-
-
-
-
-
- group
-
- div
-
-
-
- div
element as a group
container for the checkboxes.
-
-
-
- aria-labelledby
- div
References the
- id
attribute of the h3
element to define the accessible name for the group of checkboxes.
-
-
- checkbox
-
- div
-
-
-
- div
element as a checkbox
.div
provides the accessible name of the checkbox.
-
-
-
- tabindex="0"
- div
Includes the checkbox in the page tab sequence.
-
-
-
-
- aria-checked="false"
- div
-
-
-
- checkbox
is not checked.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo element and content
property are used to generate the visual indicators of the checkbox state.
-
-
-
-
- aria-checked="true"
- div
-
-
-
- checkbox
is checked.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo element and content
property are used to generate the visual indicators of the checkbox state.Javascript and CSS Source Code
-
-
- HTML Source Code
- Simple Two-State Checkbox Example
-
-
-
-
-
- EXAMPLE_NAME Example
-
-
-
- Example
-
-
- Accessibility Features
-
-
- Keyboard Support
-
-
-
-
-
-
-
-
- Key
- Function
-
-
- KeyName
-
- Description of key function.
-
-
-
-
-
- KeyName
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- RoleName
-
- HTML_ELEMENT
- Describe usage/purpose, e.g., indicates the focusable element that serves as the ...
-
-
-
-
-
-
-
-
- AttributeName=
AttributeValue
- HTML_ELEMENT
-
-
-
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
-
- Editable Combobox With Both List and Inline Autocomplete Example
-
-
- select
element.list with manual selection
.aria-autocomplete=none
.Example
-
-
- Accessibility Features
-
-
- :hover
pseudo-class, and focus
and blur
event handlers:
-
-
- input
and button
elements with 2 pixels of space between the focus ring and the combobox.forced-color-adjust
is set to auto
on the svg
element and and the fill
attribute of the polygon
element is set to currentcolor
.
- This causes the colors of the fill
of the polygon elements to be overridden by the high contrast color setting.
- If forced-color-adjust
were not used to override the colors specified for the fill
property, the color would remain the same in high contrast mode, which could lead to insufficient contrast between the arrow and the background or even make it invisible if the color matched the high contrast mode background.
- Note: The explicit setting of forced-color-adjust
is necessary because some browsers do not use auto
as the default value for SVG graphics.
- Keyboard Support
- Textbox
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
-
-
-
-
-
-
- Alt + Down Arrow
-
- Opens the listbox without moving focus or changing selection.
-
-
-
- Up Arrow
-
-
-
-
-
-
- Enter
-
-
-
-
-
-
- Escape
-
-
-
-
-
-
-
- Standard single line text editing keys
-
-
-
-
- input
with type="text"
is used for the textbox so the browser will provide platform-specific editing keys.Listbox Popup
- aria-activedescendant
on the textbox is set to a value that refers to the listbox option that is visually indicated as focused.
- Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator.
- For more information about this focus management technique, see
- Using aria-activedescendant to Manage Focus.
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
-
-
-
-
-
- Escape
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Right Arrow
- Moves visual focus to the textbox and moves the editing cursor one character to the right.
-
-
- Left Arrow
- Moves visual focus to the textbox and moves the editing cursor one character to the left.
-
-
- Home
- Moves visual focus to the textbox and places the editing cursor at the beginning of the field.
-
-
- End
- Moves visual focus to the textbox and places the editing cursor at the end of the field.
-
-
-
- Printable Characters
-
-
-
-
- Button
- Role, Property, State, and Tabindex Attributes
- Textbox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- combobox
-
-
- input[type="text"]
Identifies the input as a combobox.
-
-
-
-
-
- aria-autocomplete="both"
-
- input[type="text"]
Indicates that the autocomplete behavior of the text input is to both show an inline completion string and suggest a list of possible values in a popup where the suggestions are related to the string that is present in the textbox.
-
-
-
-
-
- aria-controls="ID_REF"
-
- input[type="text"]
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- input[type="text"]
Indicates that the popup element is not displayed.
-
-
-
-
-
- aria-expanded="true"
-
- input[type="text"]
Indicates that the popup element is displayed.
-
-
-
-
-
- id="string"
-
- input[type="text"]
-
-
-
- for
attribute of label
element to provide an accessible name.
-
-
-
-
-
- aria-activedescendant="ID_REF"
-
- input[type="text"]
-
-
-
- input
element.Listbox Popup
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- listbox
-
-
-
- ul
- Identifies the
- ul
element as a listbox
.
-
-
-
-
- aria-label="States"
-
- ul
Provides a label for the
- listbox
.
-
-
-
- option
-
-
- li
-
-
-
- listbox
option
.option
.
-
-
-
-
-
- aria-selected="true"
-
- li
-
-
-
- aria-activedescendant
and when focus is in the textbox and the first option is automatically selected.Button
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- tabindex="-1"
-
- button
Removes the button from the tab sequence of the page because its function is redundant with the keyboard operation of the combobox.
-
-
-
-
-
- aria-label="States"
-
- button
Provides a label for the
- button
.
-
-
-
-
- aria-controls="ID_REF"
-
- button
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- button
Indicates that the popup element is not displayed.
-
-
-
-
-
-
- aria-expanded="true"
-
- button
Indicates that the popup element is displayed.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
-
-
-
Editable Combobox With List Autocomplete Example
-
-
-
- select
element.list with inline autocomplete
.aria-autocomplete=none
.Example
-
-
- Accessibility Features
-
-
- :hover
pseudo-class, and focus
and blur
event handlers:
-
-
- input
and button
elements with 2 pixels of space between the focus ring and the combobox.forced-color-adjust
is set to auto
on the svg
element and and the fill
attribute of the polygon
element is set to currentcolor
.
- This causes the colors of the fill
of the polygon elements to be overridden by the high contrast color setting.
- If forced-color-adjust
were not used to override the colors specified for the fill
property, the color would remain the same in high contrast mode, which could lead to insufficient contrast between the arrow and the background or even make it invisible if the color matched the high contrast mode background.
- Note: The explicit setting of forced-color-adjust
is necessary because some browsers do not use auto
as the default value for SVG graphics.
- Keyboard Support
- Textbox
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
-
-
-
-
-
-
- Alt + Down Arrow
-
- Opens the listbox without moving focus or changing selection.
-
-
-
- Up Arrow
-
-
-
-
-
-
- Enter
- Closes the listbox if it is displayed.
-
-
- Escape
-
-
-
-
-
-
-
- Standard single line text editing keys
-
-
-
-
- input
with type="text"
is used for the textbox so the browser will provide platform-specific editing keys.Listbox Popup
- aria-activedescendant
on the textbox is set to a value that refers to the listbox option that is visually indicated as focused.
- Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator.
- For more information about this focus management technique, see
- Using aria-activedescendant to Manage Focus.
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
-
-
-
-
-
- Escape
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Right Arrow
- Moves visual focus to the textbox and moves the editing cursor one character to the right.
-
-
- Left Arrow
- Moves visual focus to the textbox and moves the editing cursor one character to the left.
-
-
- Home
- Moves visual focus to the textbox and places the editing cursor at the beginning of the field.
-
-
- End
- Moves visual focus to the textbox and places the editing cursor at the end of the field.
-
-
-
- Printable Characters
-
-
-
-
- Button
- Role, Property, State, and Tabindex Attributes
- Textbox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- combobox
-
-
- input[type="text"]
Identifies the input as a combobox.
-
-
-
-
-
- aria-autocomplete="list"
-
- input[type="text"]
Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions are related to the string that is present in the textbox.
-
-
-
-
-
- aria-controls="ID_REF"
-
- input[type="text"]
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- input[type="text"]
Indicates that the popup element is not displayed.
-
-
-
-
-
- aria-expanded="true"
-
- input[type="text"]
Indicates that the popup element is displayed.
-
-
-
-
-
- id="string"
-
- input[type="text"]
-
-
-
- for
attribute of label
element to provide an accessible name.
-
-
-
-
-
- aria-activedescendant="ID_REF"
-
- input[type="text"]
-
-
-
- input
element.Listbox Popup
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- listbox
-
-
-
- ul
- Identifies the
- ul
element as a listbox
.
-
-
-
-
- aria-label="States"
-
- ul
Provides a label for the
- listbox
.
-
-
-
- option
-
-
- li
-
-
-
- listbox
option
.option
.
-
-
-
-
-
- aria-selected="true"
-
- li
-
-
-
- aria-activedescendant
.Button
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- tabindex="-1"
-
- button
Removes the button from the tab sequence of the page because its function is redundant with the keyboard operation of the combobox.
-
-
-
-
-
- aria-label="States"
-
- button
Provides a label for the
- button
.
-
-
-
-
- aria-controls="ID_REF"
-
- button
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- button
Indicates that the popup element is not displayed.
-
-
-
-
-
-
- aria-expanded="true"
-
- button
Indicates that the popup element is displayed.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
-
-
Editable Combobox without Autocomplete Example
- no autocomplete
.
- The terms that appear in the listbox popup are not related to the string that is present in the textbox.
- In this implementation, the listbox popup is not automatically triggered when the textbox receives focus; the list is opened when the user types a character into the textbox or through an explicit open command.
-
-
-
- select
element.list with inline autocomplete
.list with manual selection
.Example
-
-
- Accessibility Features
-
-
- :hover
pseudo-class, and focus
and blur
event handlers:
-
-
- input
and button
elements with 2 pixels of space between the focus ring and the combobox.forced-color-adjust
is set to auto
on the svg
element and and the fill
attribute of the polygon
element is set to currentcolor
.
- This causes the colors of the fill
of the polygon elements to be overridden by the high contrast color setting.
- If forced-color-adjust
were not used to override the colors specified for the fill
property, the color would remain the same in high contrast mode, which could lead to insufficient contrast between the arrow and the background or even make it invisible if the color matched the high contrast mode background.
- Note: The explicit setting of forced-color-adjust
is necessary because some browsers do not use auto
as the default value for SVG graphics.
- Keyboard Support
- Textbox
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
-
-
-
-
-
-
- Alt + Down Arrow
-
- Opens the listbox without moving focus or changing selection.
-
-
-
- Up Arrow
-
-
-
-
-
-
- Enter
- Closes the listbox if it is displayed.
-
-
-
- Standard single line text editing keys
-
-
-
-
- input
with type="text"
is used for the textbox so the browser will provide platform-specific editing keys.Listbox Popup
- aria-activedescendant
on the textbox is set to a value that refers to the listbox option that is visually indicated as focused.
- Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator.
- For more information about this focus management technique, see
- Using aria-activedescendant to Manage Focus.
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
-
-
-
-
-
- Escape
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Right Arrow
- Moves visual focus to the textbox and moves the editing cursor one character to the right.
-
-
- Left Arrow
- Moves visual focus to the textbox and moves the editing cursor one character to the left.
-
-
- Home
- Moves visual focus to the textbox and places the editing cursor at the beginning of the field.
-
-
- End
- Moves visual focus to the textbox and places the editing cursor at the end of the field.
-
-
-
- Printable Characters
-
-
-
-
- Button
- Role, Property, State, and Tabindex Attributes
- Textbox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- combobox
-
-
- input[type="text"]
Identifies the input as a combobox.
-
-
-
-
-
- aria-autocomplete="none"
-
- input[type="text"]
Indicates that the suggestions in the combobox popup are not values that complete the current textbox input.
-
-
-
-
-
- aria-controls="ID_REF"
-
- input[type="text"]
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- input[type="text"]
Indicates that the popup element is not displayed.
-
-
-
-
-
- aria-expanded="true"
-
- input[type="text"]
Indicates that the popup element is displayed.
-
-
-
-
-
- id="string"
-
- input[type="text"]
-
-
-
- for
attribute of label
element to provide an accessible name.
-
-
-
-
-
- aria-activedescendant="ID_REF"
-
- input[type="text"]
-
-
-
- input
element.Listbox Popup
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- listbox
-
-
-
- ul
- Identifies the
- ul
element as a listbox
.
-
-
-
-
- aria-label="Previous Searches"
-
- ul
Provides a label for the
- listbox
.
-
-
-
- option
-
-
- li
-
-
-
- listbox
option
.option
.
-
-
-
-
-
- aria-selected="true"
-
- li
-
-
-
- aria-activedescendant
.Button
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- tabindex="-1"
-
- button
Removes the button from the tab sequence of the page, since it's keyboard function is redundant with the keyboard operation of the textbox to open the listbox.
-
-
-
-
-
- aria-label="Previous Searches"
-
- button
Provides a label for the
- button
.
-
-
-
-
- aria-controls="ID_REF"
-
- button
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- button
Indicates that the popup element is not displayed.
-
-
-
-
-
-
- aria-expanded="true"
-
- button
Indicates that the popup element is displayed.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Date Picker Combobox Example
-
-
-
- select
element.aria-autocomplete=none
.Example
-
- December 2020
-
-
-
-
-
-
-
-
-
-
- Su
- Mo
- Tu
- We
- Th
- Fr
- Sa
-
-
-
-
-
-
-
-
- 1
-
-
- 2
- 3
- 4
- 5
- 6
- 7
- 8
-
-
- 9
- 10
- 11
- 12
- 13
- 14
- 15
-
-
- 16
- 17
- 18
- 19
- 20
- 21
- 22
-
-
- 23
- 24
- 25
- 26
- 27
- 28
- 29
-
-
-
- 30
- 31
-
-
-
-
-
- Accessibility Features
-
-
- aria-describedby
, making it available to assistive technologies as an accessible description.combobox
design pattern, it is made accessible to assistive technologies as the Choose Date button.
- This enables assistive technology users who might not have a keyboard, e.g., someone using a touch-based screen reader, to open the date picker dialog.
- abbr
attribute on the column headers, enabling screen readers to announce the full names when users navigate the grid.
-
-
- Keyboard Support
-
- Combobox
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Down Arrow,
-
ALT + Down Arrow
-
-
-
- Date Picker Dialog
-
-
-
-
-
-
-
- Key
- Function
-
-
- ESC
- Closes the dialog and moves focus to the combobox.
-
-
- TAB
-
-
-
-
-
-
-
- Shift + TAB
-
-
-
-
- Date Picker Dialog: Calendar Buttons
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space,
-
Enter
- Change the month and/or year displayed in the calendar grid.
-
- Date Picker Dialog: Date Grid
-
-
-
-
-
-
-
- Key
- Function
-
-
- Space
-
-
-
-
- combobox
with the selected date.
-
- Enter
-
-
-
-
- combobox
with the selected date.combobox
.
-
- Up Arrow
- Moves focus to the same day of the previous week.
-
-
- Down Arrow
- Moves focus to the same day of the next week.
-
-
- Right Arrow
- Moves focus to the next day.
-
-
- Left Arrow
- Moves focus to the previous day.
-
-
- Home
- Moves focus to the first day (e.g. Sunday) of the current week.
-
-
- End
- Moves focus to the last day (e.g. Saturday) of the current week.
-
-
- PageUp
-
-
-
-
-
-
- Shift+
-
PageUp
-
-
-
-
-
- PageDown
-
-
-
-
-
-
-
- Shift+
-
PageDown
-
-
-
- Date Picker Dialog: OK and Cancel Buttons
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space,
-
Enter
- Activates the button:
-
-
-
- Role, Property, State, and Tabindex Attributes
-
- Combobox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- combobox
-
- input
- Identifies the
- input
element as a combobox.
-
-
-
-
- aria-haspopup="dialog"
- input
- Indicates that the combobox opens a dialog.
-
-
-
-
-
- aria-expanded="false"
- input
- Indicates that the combobox is collapsed, i.e., the "Choose Date" dialog is not displayed.
-
-
-
-
-
- aria-expanded="true"
- input
- Indicates that the combobox is expanded, i.e., the "Choose Date" dialog is open.
-
-
-
-
-
- aria-autocomplete="none"
- input
- Indicates the combobox does not support autocomplete.
-
-
-
-
-
- aria-controls="IDREF"
- input
- Identifies the element controlled by the combobox.
-
-
-
-
-
-
- aria-describedby="IDREF"
- input
- Identifies the element that provides an accessible description for the combobox, enabling assistive technologies to associate the date format description with the input.
-
- Choose Date Button
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- tabindex="-1"
- button
- Excludes the button (i.e., the down arrow icon) from the Tab sequence as specified by the combobox design pattern.
-
-
-
-
-
-
- aria-label="string"
- button
Defines the accessible name as "Choose Date", which matches the title of the dialog opened by activating the button.
- Date Picker Dialog
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- dialog
-
-
- div
- Identifies the element as a dialog.
-
-
-
-
- aria-modal="true"
- div
Indicates the dialog is modal.
-
-
-
-
- aria-label="Choose Date"
- div
Defines the accessible name for the dialog.
-
-
-
-
- aria-live="polite"
- h2
-
-
-
- polite
value indicates that other announcements should not be interrupted.
-
-
-
-
- aria-live="polite"
- div
-
-
-
- polite
value indicates that other announcements should not be interrupted.Date Picker Dialog: Calendar Navigation Buttons
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-label="String"
- button
- Defines the accessible name of the button (e.g. "Next Year").
-
- Date Picker Dialog: Date Grid
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- grid
-
-
- table
-
-
-
-
- table
element as a grid
widget.grid
role is applied to a table
element, the row
, columnheader
, and gridcell
roles do not need to be specified because they are implied by tr
, th
, and td
tags.
-
-
-
- aria-labelledby="IDREF"
- table
- Identifies the element that provides the accessible name for the
- grid
, which is the h2
that shows the month and year of the dates displayed in the grid.
-
-
-
-
-
-
- tabindex="0"
-
-
- td
-
-
-
-
-
-
-
-
-
- tabindex="-1"
-
-
- td
-
-
-
-
- 0
by the JavaScript when the gridcell is to be included in the dialog Tab sequence.
-
-
-
-
- aria-selected="true"
- td
-
-
-
- aria-selected
specified.abbr
attribute to the th
elements.
- So, each th
element includes an abbr
attribute containing the full spelling of the name of the day for that column.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- combobox
Design Pattern in WAI-ARIA Authoring Practices 1.2
- Select-Only Combobox Example
- select
element.
- Unlike the editable combobox examples, this select-only combobox is not made with an <input>
element, and it does not accept freeform user input.
- However, like an HTML <select>
, users can type characters to select matching options.
-
-
-
- list with inline autocomplete
.list with manual selection
.aria-autocomplete=none
.Example
- Accessibility Features
- select
element with the attribute size="1"
, the following differences in behavior are implemented to improve both accessibility and general usability.
-
- aria-activedescendant
.
- This enables users to perceive the presence of the options, and enables assistive technology users to comprehend the size of the list of options.
- aria-activedescendant
like they do for elements with focus. When a keyboard event changes the active option in the listbox, the JavaScript scrolls the option referenced by aria-activedescendant
into view. Managing aria-activedescendant
visibility is essential to accessibility for people who use a browser's zoom feature to increase the size of content.Keyboard Support
- Closed Combobox
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
-
-
-
-
-
-
- Alt + Down Arrow
-
- Opens the listbox without moving focus or changing selection.
-
-
-
- Up Arrow
-
-
-
-
-
-
- Enter
-
- Opens the listbox without moving focus or changing selection.
-
-
-
- Space
-
- Opens the listbox without moving focus or changing selection.
-
-
-
- Home
-
- Opens the listbox and moves visual focus to the first option.
-
-
-
- End
-
- Opens the listbox and moves visual focus to the last option.
-
-
-
-
- Printable Characters
-
-
-
-
- Listbox Popup
- aria-activedescendant
on the combobox is set to a value that refers to the listbox option that is visually indicated as focused.
- Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator.
- For more information about this focus management technique, see
- Using aria-activedescendant to Manage Focus.
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
-
-
-
-
-
- Space
-
-
-
-
-
-
- Tab
-
-
-
-
- <select>
element closes the listbox but does not move focus on tab.
- This pattern matches the behavior of the other comboboxes rather than the native element in this case.
-
- Escape
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Alt + Up Arrow
-
-
-
-
-
-
- Home
- Moves visual focus to the first option.
-
-
- End
- Moves visual focus to the last option.
-
-
- PageUp
- Jumps visual focus up 10 options (or to first option).
-
-
- PageDown
- Jumps visual focus down 10 options (or to last option).
-
-
-
- Printable Characters
-
-
-
-
- Role, Property, State, and Tabindex Attributes
- Combobox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- combobox
-
-
- div
Identifies the input as a combobox.
-
-
-
-
-
- aria-labelledby="#IDREF"
-
- div
Identifies the element that labels the combobox.
-
-
-
-
-
- aria-controls="#IDREF"
-
- div
Identifies the element that serves as the popup.
-
-
-
-
-
- aria-expanded="false"
-
- div
Indicates that the popup element is not displayed.
-
-
-
-
-
- aria-expanded="true"
-
- div
Indicates that the popup element is displayed.
-
-
-
-
-
-
- aria-activedescendant="IDREF"
-
- div
-
-
-
- input
element.Listbox Popup
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- listbox
-
-
-
- div
- Identifies the element as a
- listbox
.
-
-
-
- option
-
-
- div
-
-
-
- listbox
option
.option
.
-
-
-
-
-
- aria-selected="true"
-
- li
-
-
-
- aria-activedescendant
.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Editable Combobox with Grid Popup Example
-
-
-
- select
element.list with inline autocomplete
.list with manual selection
.aria-autocomplete=none
.Example
- Accessibility Features
- aria-activedescendant
like they do for elements with focus. When a keyboard event changes the active option in the listbox, the JavaScript scrolls the option referenced by aria-activedescendant
into view. Managing aria-activedescendant
visibility is essential to accessibility for people who use a browser's zoom feature to increase the size of content.
- Keyboard Support
- Textbox
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
- If the grid is displayed, moves focus to the first suggested value.
-
-
- Up Arrow
- If the grid is displayed, moves focus to the last suggested value.
-
-
- Escape
-
-
-
-
-
-
-
- Standard single line text editing keys
-
-
-
-
- input
with type=
is used for the textbox so the browser will provide platform-specific editing keys.text
Grid Popup
- aria-activedescendant
on the textbox is set to a value that refers to an element in the grid that is visually indicated as focused.
- Where the following descriptions of keyboard commands mention focus, they are referring to the visual focus indicator.
- For more information about this focus management technique, see
- Using aria-activedescendant to Manage Focus.
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
-
-
-
-
-
- Escape
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Right Arrow
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
- Home
- Moves focus to the textbox and places the editing cursor at the beginning of the field.
-
-
- End
- Moves focus to the textbox and places the editing cursor at the end of the field.
-
-
-
- Printable Characters
-
-
-
-
- Role, Property, State, and Tabindex Attributes
- Textbox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- combobox
-
-
- input[type="text"]
Identifies the element as a combobox.
-
-
-
-
-
- aria-haspopup="grid"
-
- input[type="text"]
Indicates that the combobox can popup a
- grid
to suggest values.
-
-
-
-
- aria-expanded="false"
-
- input[type="text"]
Indicates that the popup element is not displayed.
-
-
-
-
-
- aria-expanded="true"
-
- input[type="text"]
Indicates that the popup element is displayed.
-
-
-
-
-
- id="string"
-
- input[type="text"]
-
-
-
- for
attribute of label
element to provide an accessible name.
-
-
-
-
- aria-autocomplete="list"
-
- input[type="text"]
Indicates that the autocomplete behavior of the input is to suggest a list of possible values in a popup.
-
-
-
-
-
- aria-controls="IDREF"
-
- input[type="text"]
Identifies the popup element that lists suggested values.
-
-
-
-
-
-
- aria-activedescendant="IDREF"
-
- input[type="text"]
-
-
-
- input
element.Grid Popup
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- grid
-
-
-
- div
- Identifies the element as a
- grid
.
-
-
-
-
- aria-labelledby="IDREF"
-
- div
Provides a label for the
- grid
element controlled by the combobox.
-
-
-
- row
-
-
- div
Identifies the element containing all the cells for a row.
-
-
-
-
-
- aria-selected="true"
-
- div
-
-
-
- aria-activedescendant
.
-
-
-
- gridcell
-
- div
Identifies the element containing the content for a single cell.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Date Picker Dialog Example
-
-
- Example
-
- February 2020
-
-
-
-
-
-
-
-
-
-
-
- Su
- Mo
- Tu
- We
- Th
- Fr
- Sa
-
-
-
-
-
-
-
-
- 1
-
-
- 2
- 3
- 4
- 5
- 6
- 7
- 8
-
-
- 9
- 10
- 11
- 12
- 13
- 14
- 15
-
-
- 16
- 17
- 18
- 19
- 20
- 21
- 22
-
-
- 23
- 24
- 25
- 26
- 27
- 28
- 29
-
-
-
- 30
- 31
-
-
-
-
-
- Accessibility Features
-
-
- aria-describedby
, making it available to assistive technologies as an accessible description.abbr
attribute on the column headers, enabling screen readers to announce the full names when users navigate the grid.
-
-
- Keyboard Support
-
- Choose Date Button
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space,
-
Enter
-
-
-
- Date Picker Dialog
-
-
-
-
-
-
-
- Key
- Function
-
-
- ESC
- Closes the dialog and returns focus to the "Choose Date" button.
-
-
- Tab
-
-
-
-
-
-
-
- Shift + Tab
-
-
-
-
- Date Picker Dialog: Month/Year Buttons
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space,
-
Enter
- Change the month and/or year displayed in the calendar grid.
-
- Date Picker Dialog: Date Grid
-
-
-
-
-
-
-
- Key
- Function
-
-
- Space,
-
Enter
-
-
-
-
-
- Up Arrow
- Moves focus to the same day of the previous week.
-
-
- Down Arrow
- Moves focus to the same day of the next week.
-
-
- Right Arrow
- Moves focus to the next day.
-
-
- Left Arrow
- Moves focus to the previous day.
-
-
- Home
- Moves focus to the first day (e.g Sunday) of the current week.
-
-
- End
- Moves focus to the last day (e.g. Saturday) of the current week.
-
-
- Page Up
-
-
-
-
-
-
- Shift + Page Up
-
-
-
-
-
-
- Page Down
-
-
-
-
-
-
-
- Shift + Page Down
-
-
-
-
- Date Picker Dialog: OK and Cancel Buttons
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space,
-
Enter
- Activates the button:
-
-
-
- Role, Property, State, and Tabindex Attributes
-
- Textbox
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-describedby="IDREF"
- input
- Identifies the element that provides an accessible description for the textbox, enabling assistive technologies to associate the date format description with the input.
-
- Choose Date Button
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-label="String"
- button
-
-
-
- Date Picker Dialog
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- dialog
-
-
- div
- Identifies the element as a dialog .
-
-
-
-
- aria-modal="true"
- div
Indicates the dialog is modal.
-
-
-
-
- aria-label="string"
- div
- Defines the accessible name for the dialog.
-
-
-
-
-
- aria-live="polite"
-
- h2
-
-
-
-
- h2
element is updated.h2
should be automatically announced by screen readers.
-
-
-
-
- aria-live="polite"
- div
-
-
-
- Date Picker Dialog: Calendar Navigation Buttons
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-label="String"
- button
Defines the accessible name of the button (e.g. "Next Year").
- Date Picker Dialog: Date Grid
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- grid
-
-
- table
-
-
-
-
- table
element as a grid
widget.grid
role is applied to a table
element, the row
, columnheader
, and gridcell
roles do not need to be specified because they are implied by tr
, th
, and td
tags.
-
-
-
- aria-labelledby="IDREF"
- table
Identifies the element that provides the accessible name for the
- grid
.
-
-
-
-
- tabindex="0"
-
-
- td
-
-
-
-
- gridcell
within the grid is in the dialog Tab sequence.
-
-
-
-
- tabindex="-1"
-
-
- td
-
-
-
-
- 0
by the JavaScript when the cell is to be included in the dialog Tab sequence.gridcell
within the grid is in the dialog Tab sequence.
-
-
-
-
- aria-selected="true"
- td
-
-
-
- aria-selected
specified.abbr
attribute to the th
elements.
- So, each th
element includes a abbr
attribute containing the full spelling of the name of the day for that column.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Modal Dialog Example
- Add Delivery Address
button opens a modal dialog that contains two buttons that open other dialogs.
- The accessibility features section explains the rationale for initial focus placement and use of aria-describedby
in each dialog.
-
-
- Example
- Add Delivery Address
- Verification Result
-
-
-
-
-
-
-
-
- tabindex=
. The first
- paragraph is also contained inside the element that provides the dialog description, i.e., the element that is referenced
- by -1
aria-describedby
. With some screen readers, this may have one negative
- but relatively insignificant side effect when the dialog opens -- the first paragraph
- may be announced twice. Nonetheless, making the first paragraph focusable and setting
- the initial focus on it is the most broadly accessible option.
- Address Added
- End of the Road!
- Accessibility Features
-
-
-
-
- Add Delivery Address
dialog (id=dialog1):
-
-
- aria-describedby
since there is no static text that describes it.Cancel
action, the user's point of regard is maintained by returning focus to the Add Delivery Address
button.Add
action and the Address Added
dialog replaces the Add Delivery Address
dialog,
- the Add Delivery Address
dialog passes a reference to the Add Delivery Address
button to the Address Added
dialog
- so that it can maintain the user's point of regard when it closes.
- Verification Result
dialog (id=dialog2):
-
-
- div
that is referenced by aria-describedby
.Verify Address
button.Address Added
dialog (id=dialog3):
-
-
- OK
button, which is the last focusable element.
- This is for efficiency since most users will simply dismiss the dialog as soon as they have read the message.
- Users can press Tab to focus on the My Profile
link.
- aria-describedby
to hint to screen readers that it should be announced when the dialog opens.Add Delivery Address
button.End of the Road!
dialog (id=dialog4):
-
-
- aria-describedby
is used to facilitate message announcement for screen reader users.Address Added
confirmation dialog, when it closes, the user's point of regard is maintained by returning focus to the element that triggered display of the dialog.Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
-
-
-
-
-
-
- Shift + Tab
-
-
-
-
-
-
-
- Escape
- Closes the dialog.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- dialog
-
- div
- Identifies the element that serves as the dialog container.
-
-
-
-
-
- aria-labelledby=
IDREF
- div
- Gives the dialog an accessible name by referring to the element that provides the dialog title.
-
-
-
-
-
- aria-describedby=
IDREF
- div
-
-
-
-
-
-
-
-
- aria-modal=
true
- div
- Tells assistive technologies that the windows underneath the current dialog are not available for interaction (inert).
-
- Notes on
- aria-modal
and aria-hidden
-
- aria-modal
property was introduced in ARIA 1.1.
- As a new property, screen reader users may experience varying degrees of support for it.
- aria-modal
property to the dialog
element
- replaces the technique of using aria-hidden
on the background for informing assistive technologies that content outside a dialog is inert.
- aria-hidden
is used to make content outside a dialog inert for assistive technology users, it is important that:
-
-
- aria-hidden
is set to true
on each element containing a portion of the inert layer.aria-hidden
set to true
.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Example Disclosure (Show/Hide) for Answers to Frequently Asked Questions
-
-
- Example
- Parking FAQs
-
-
- Holidays
in the calendar. Please note: 24-hour rental spaces, 24-hour rental lots, and
- disabled parking is enforced at all times.
- Accessibility Features
-
-
- dl
, dt
and dd
elements.
- To ensure the list structure is communicated to assistive technologies, instead of applying a button role to the dt
element, a button
element is contained within the dt
element.
- Similarly, each div
element containing answer content that can be shown or hidden by the button is a child of a dd
element.
- Since all the dd
elements are present in the DOM even if some answers are hidden, the dl
structure is always complete.
- currentcolor
value for the stroke
and fill
properties of the polygon
elements used to draw the arrows.
- If specific colors were instead used to specify the polygon
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the arrows and the background or even make the arrows invisible if the color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Tab
-
-
- Moves keyboard focus to the disclosure button.
-
-
-
-
-
- Space or
-
- Enter
-
- Activates the disclosure button,
- which toggles the visibility of the answer to the question.
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-controls="ID_REFERENCE"
-
- button
Identifies the element controlled by the disclosure button.
-
-
-
-
-
- aria-expanded="false"
-
-
- button
-
-
-
-
- [aria-expanded="false"]
) are
- used to synchronize the visual states with the value of the aria-expanded
- attribute.
- :before
pseudo element and content
property
- so the image is reliably rendered in high contrast mode of operating systems and browsers.
-
-
-
-
-
-
- aria-expanded="true"
-
-
- button
-
-
-
-
- [aria-expanded="true"]
) are
- used to synchronize the visual states with the value of the aria-expanded
- attribute.
- :before
pseudo element and content
property
- so the image is reliably rendered in high contrast mode of operating systems and browsers.
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
- Example Disclosure (Show/Hide) for Image Description
-
-
- Example
-
-
Data for Charles Minard's Chart of Napoleon's Invasion of Russia
-
-
-
-
-
-
-
- Location
- Approximate Date
- Size of Army
- Temperature C
- Temperature F
- Direction
-
-
- Kowno River
- June 24th
- 442,000
- na
- na
- Advance
-
-
- Wilna
- June 30th
- 400,000
- na
- na
- Advance
-
-
- Witebsk
- na
- 175,000
- na
- na
- Advance
-
-
- Smolensk
- August 16th
- 145,000
- na
- na
- Advance
-
-
- Chjat
- na
- 127,000
- na
- na
- Advance
-
-
- Mojaisk
- September 7th
- 100,000
- na
- na
- Advance
-
-
- Moscow
- September 14th
- 100,000
- na
- na
- Advance
-
-
- Malo-jarosewli
- October 18th
- 96,000
- 0
- 32
- Retreat
-
-
- Mojaisk
- October 24th
- 87,000
- 0
- 32
- Retreat
-
-
- Wirma
- na
- 55,000
- na
- na
- Retreat
-
-
- Smolensk
- November 14th
- 37,000
- -26
- -13
- Retreat
-
-
- Orscha
- na
- 24,000
- na
- na
- Retreat
-
-
- Botr
- na
- 20,000
- -14
- -7
- Retreat
-
-
- Studienska (reinforcements arrive)
- December 1st
- 50,000
- -25
- -13
- Retreat
-
-
- Minsk
- December 1st
- 28,000
- -30
- -22
- Retreat
-
-
- Moloderno
- December 6th
- 28,000
- -38
- -34
- Retreat
-
-
- Smorgeni
- December 7th
- 12,000
- -33
- -27
- Retreat
-
-
- Wilna
- na
- 8,000
- na
- na
- Retreat
-
-
-
- Kowno (reinforcements arrive)
- December 14th
- 10,000
- na
- na
- Retreat
- Accessibility Features
-
-
- currentcolor
value for the stroke
and fill
properties of the polygon
elements used to draw the arrows.
- If specific colors were instead used to specify the polygon
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the arrows and the background or even make the arrows invisible if the color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Tab
-
-
- Moves keyboard focus to the disclosure button.
-
-
-
-
-
- Space or
-
- Enter
-
- Activates the disclosure button,
- which toggles the visibility of the long description.
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-controls="ID_REFERENCE"
-
- button
Identifies the element controlled by the disclosure button.
-
-
-
-
-
- aria-expanded="false"
-
-
- button
-
-
-
-
- [aria-expanded="false"]
)
- synchronize the visual states with the value of the aria-expanded
- attribute.
- :before
pseudo element and the content
property
- so the image is reliably rendered in high contrast mode of operating systems and browsers.
-
-
-
-
-
-
- aria-expanded="true"
-
-
- button
-
-
-
-
- [aria-expanded="true"]
)
- synchronize the visual states with the value of the aria-expanded
- attribute.
- :before
pseudo element and the content
property
- so the image is reliably rendered in high contrast mode of operating systems and browsers.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Example Disclosure Navigation Menu with Top-Level Links
-
-
-
- Example Usage Options
- Example
-
-
- Home
- Accessibility Features
-
-
- Mythical University
.
-
- grid
, that is expected to occupy only one stop in the page Tab sequence and manage focus for all its descendants.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Tab
-
- Shift + Tab
- Move keyboard focus among top-level links and buttons, and if a dropdown is open, through links in the dropdown.
-
-
-
- Space or
-
- Enter
-
-
-
-
-
-
- aria-current
set, removes it.aria-current="page"
on the focused link.
-
-
- Escape
-
- If a dropdown is open, closes it and sets focus on the button that controls that dropdown.
-
-
-
- Down Arrow or
-
- Right Arrow
- (Optional)
-
-
-
-
-
-
-
- Up Arrow or
-
- Left Arrow
- (Optional)
-
-
-
-
-
-
-
- Home (Optional)
-
-
-
-
-
-
-
-
-
- End (Optional)
-
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-controls="IDREF"
-
-
- button
-
- Indicates that the disclosure button controls visibility of the container identified by the
- IDREF
value.
-
-
-
-
-
- aria-expanded="false"
-
-
- button
-
-
-
-
- [aria-expanded="false"]
) are
- used to synchronize the visual states with the value of the aria-expanded
- attribute.
-
-
-
-
-
- aria-expanded="true"
-
-
- button
-
-
-
-
- [aria-expanded="true"]
) are
- used to synchronize the visual states with the value of the aria-expanded
- attribute.
-
-
-
-
-
-
- aria-current="page"
-
-
- a
- Indicates that the page referenced by the link is currently displayed.
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
- Example Disclosure Navigation Menu
-
-
- Example Usage Options
- Example
-
-
- Mythical University
- Accessibility Features
-
-
- Mythical University
.::after
pseudo element border styles so the caret is reliably rendered in high contrast mode of operating systems and browsers.
-
- grid
, that is expected to occupy only one stop in the page Tab sequence and manage focus for all its descendants.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Tab
-
- Shift + Tab
- Move keyboard focus among top-level buttons, and if a dropdown is open, into and through links in the dropdown.
-
-
-
- Space or
-
- Enter
-
-
-
-
-
-
- aria-current
set, removes it.aria-current="page"
on the focused link.
-
-
- Escape
-
- If a dropdown is open, closes it and sets focus on the button that controls that dropdown.
-
-
-
- Down Arrow or
-
- Right Arrow
- (Optional)
-
-
-
-
-
-
-
- Up Arrow or
-
- Left Arrow
- (Optional)
-
-
-
-
-
-
-
- Home (Optional)
-
-
-
-
-
-
-
-
-
- End (Optional)
-
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
- aria-controls="IDREF"
-
-
- button
-
- The disclosure button controls visibility of the container identified by the
- IDREF
value.
-
-
-
-
-
- aria-expanded="false"
-
-
- button
-
-
-
-
- [aria-expanded="false"]
) are
- used to synchronize the visual states with the value of the aria-expanded
- attribute.
-
-
-
-
-
- aria-expanded="true"
-
-
- button
-
-
-
-
- [aria-expanded="true"]
) are
- used to synchronize the visual states with the value of the aria-expanded
- attribute.
-
-
-
-
-
-
- aria-current="page"
-
-
- a
- Indicates that the page referenced by the link is currently displayed.
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
- Feed Example
- Example
-
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Page Down
- Move focus to next article.
-
-
- Page Up
- Move focus to previous article.
-
-
- Control + End
- Move focus to the first focusable element after the feed.
-
-
-
- Control + Home
- Move focus to the first focusable element before the feed.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- feed
-
- div
-
-
-
-
-
-
-
- aria-labelledby="IDREF"
- div
Provides an accessible name for the feed element.
-
-
-
-
- aria-busy="true"
- div
-
-
-
-
-
-
- article
-
- div
-
-
-
-
-
-
-
- tabindex="0"
- div
-
-
-
-
-
-
-
- aria-labelledby="IDREF_LIST"
- div
-
-
-
-
-
-
-
- aria-describedby="IDREF_LIST"
- div
-
-
-
-
-
-
-
- aria-posinset="INTEGER"
- div
-
-
-
-
-
-
-
-
- aria-setsize="INTEGER"
- div
Set to the total number of articles currently contained by the feed element.
- Javascript and CSS Source Code
-
-
- HTML Source Code
- Recommended Restaurants
- Layout Grid Examples
- grid
that enables it to be used for grouping other widgets is that its cells are containers that preserve the semantics of their descendant elements.
- That is, grid cells do not override or suppress the semantics of the elements they contain.
- Thus, a link contained inside of a grid cell is presented to a screen reader as a link.
- By contrast, a link inside of a menu is presented as a menuitem, and a link inside of a listbox is presented as an option.
-
-
- Examples
- Example 1: Simple List of Links
- Related Documents
-
-
- Notes
-
-
-
-
- NUX
(new user experience helper) appears in the page tab sequence immediately following the grid.
- The NUX explains the meaning of the focus indicator and keypad graphic, and it remains visible until the user closes it.
- Example 2: Pill List For a List of Message Recipients
- Notes
-
-
-
-
- Example 3: Scrollable Search Results
- Search Results for "W3C WAI-ARIA"
-
- ARIA
- in HTML
-
Notes
-
-
- aria-rowindex
- value of the row containing focus informs assistive technologies of the number of that row
- within the total set of rows.
- Other Features
-
-
-
-
- tabindex="-1"
, focus is placed on the cell. Otherwise, it is placed on a focusable element inside the cell.
-
- data-wrap-cols="true"
: When this custom data attribute is on the grid, Right Arrow and Left Arrow
- move focus from column to column even across row boundaries to the column (cell) in the next or previous row.
- Setting it false
will disable this type of wrapping.
- data-wrap-rows="true"
: When this custom data attribute is on the grid, Down Arrow and Up Arrow
- move focus from row to row even across column boundaries to the row (cell) in the next or previous column.
- Setting it false
will disable this type of wrapping.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
-
-
- Page Down (Example 3)
-
-
-
-
-
-
-
-
- Page Up (Example 3)
-
-
-
-
-
-
-
-
- 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.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- grid
-
- div
- Identifies the element containing the grid widget.
- Because focus is managed using roving tabindex, the grid element is not focusable.
-
-
-
-
-
-
- aria-labelledby="ID_REF"
-
- div
Refers to the element that labels the grid.
-
-
-
-
- aria-rowcount="19"
- div
-
-
-
- display:none
, which excludes them from the browser's accessibility tree.aria-rowcount
is used when not all data is loaded into the DOM at one time.
-
-
- row
-
- div
-
-
-
-
-
-
-
-
-
- aria-rowindex="INDEX_VALUE"
- div
-
-
-
-
-
-
- gridcell
-
- span, div
Identifies the element containing the content for a single cell.
-
-
-
-
- tabindex="-1"
- span, div
-
-
-
- 0
by the JavaScript when the cell is to be included in the page Tab sequence.
-
-
-
- tabindex="-1"
Widgets inside cells
-
-
-
-
- 0
by the JavaScript when the widget is to be included in the page Tab sequence.
-
-
-
-
- tabindex="0"
span, div, or if present, widget inside cell
-
-
-
-
- Javascript and CSS Source Code
-
-
-
-
-
-
- HTML Source Code
- Example 1: Simple List of Links
-
-
-
-
-
- Example 2: Pill List For Components Like a List of Message Recipients
-
-
-
-
-
- Example 3: Scrollable Search Results
-
-
-
-
-
-
- Advanced Data Grid
-
-
- Example
-
-
-
-
- Accessibility Features
-
-
- tabindex
valuesKeyboard Support
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
-
- Attribute
- Applied to Element
- Usage
-
-
-
- role="ROLE_NAME"
- HTML_ELEMENT
Brief explanation of usage, purpose, benefit, and/or guidance that is relevant to this specific implementation.
-
-
-
-
-
- aria-labelledby="ID_REF"
-
- HTML_ELEMENT
Brief explanation of usage, purpose, benefit, and/or guidance that is relevant to this specific implementation.
-
-
-
- And so on ... covering all relevant attributes
- ...
- ...
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
-
- Data Grid Examples
-
-
- Examples
- Example 1: Minimal Data Grid
- Transactions January 1 through January 6
-
-
-
-
- Date
- Type
- Description
- Amount
- Balance
-
-
- 01-Jan-16
- Deposit
-
- Cash Deposit
-
- $1,000,000.00
- $1,000,000.00
-
-
- 02-Jan-16
- Debit
-
- Down Town Grocery
-
- $250.00
- $999,750.00
-
-
- 03-Jan-16
- Debit
-
- Hot Coffee
-
- $9.00
- $999,741.00
-
-
- 04-Jan-16
- Debit
-
- The Filling Station
-
- $88.00
- $999,653.00
-
-
- 05-Jan-16
- Debit
-
- Tinker's Hardware
-
- $3,421.00
- $996,232.00
-
-
- 06-Jan-16
- Debit
-
- Cutey's Salon
-
- $700.00
- $995,532.00
- Notes
-
-
- Example 2: Sortable Data Grid With Editable Cells
- Transactions January 1 through January 7
-
-
-
-
-
- Date
-
- Type
- Description
- Category
-
- Amount
-
- Balance
-
-
- 01-Jan-16
- Deposit
-
-
-
-
- $1,000,000.00
- $1,000,000.00
-
-
- 02-Jan-16
- Debit
-
-
-
-
- $250.00
- $999,750.00
-
-
- 03-Jan-16
- Debit
-
-
-
-
- $9.00
- $999,741.00
-
-
- 04-Jan-16
- Debit
-
-
-
-
- $88.00
- $999,653.00
-
-
- 05-Jan-16
- Debit
-
-
-
-
- $3,421.00
- $996,232.00
-
-
- 06-Jan-16
- Debit
-
-
-
-
- $700.00
- $995,532.00
-
-
- 07-Jan-16
- Debit
-
-
-
-
- $41.00
- $995,491.00
- Notes
-
-
- Example 3: Scrollable Data Grid With Column Hiding
- Transactions for January 1 through January 15
-
-
-
-
- Date
- Type
- Description
- Category
- Amount
- Balance
-
-
- 01-Jan-16
- Deposit
-
- Cash Deposit
-
- Income
- $1,000,000.00
- $1,000,000.00
-
-
- 02-Jan-16
- Debit
-
- Down Town Grocery
-
- Groceries
- $250.00
- $999,750.00
-
-
- 03-Jan-16
- Debit
-
- Hot Coffee
-
- Dining Out
- $9.00
- $999,741.00
-
-
- 04-Jan-16
- Debit
-
- The Filling Station
-
- Auto
- $88.00
- $999,653.00
-
-
- 05-Jan-16
- Debit
-
- Tinker's Hardware
-
- Household
- $3,421.00
- $996,232.00
-
-
- 06-Jan-16
- Debit
-
- Cutey's Salon
-
- Beauty
- $700.00
- $995,532.00
-
-
- 07-Jan-16
- Debit
-
- My Chocolate Shop
-
- Dining Out
- $41.00
- $995,491.00
-
-
- 08-Jan-16
- Debit
-
- Who's Cook'n
-
- Dining Out
- $150.00
- $995,341.00
-
-
- 09-Jan-16
- Debit
-
- Dmuddy Paws
-
- Pet
- $100.00
- $995,241.00
-
-
- 10-Jan-16
- Debit
-
- West End Bikes
-
- Recreation
- $6,420.00
- $988,821.00
-
-
- 11-Jan-16
- Debit
-
- Pay More Cars
-
- Auto
- $431,323.00
- $557,498.00
-
-
- 12-Jan-16
- Debit
-
- The Interior Shop
-
- Household
- $142,334.00
- $415,164.00
-
-
- 13-Jan-16
- Debit
-
- Adventure Guys
-
- Recreation
- $88,424.00
- $326,740.00
-
-
- 14-Jan-16
- Debit
-
- Hungry Folks Place
-
- Dining Out
- $313.00
- $326,427.00
-
-
- 15-Jan-16
- Debit
-
- Horse Play
-
- Recreation
- $2,421.00
- $324,006.00
- Notes
-
-
- aria-rowindex
- value of the row containing the focus informs the screen reader of the number of that row
- within the total set of rows.
- aria-colindex
value on a cell informs screen readers of the
- position of that cell within the row.
- When one or more columns are hidden, screen reader users can be aware of the hidden columns
- because those column numbers are not present as users navigate across a row.
- Keyboard Support
-
-
-
-
- key
- Function
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
-
-
- Page Down
-
-
-
-
-
-
-
-
- Page Up
-
-
-
-
-
-
-
-
- 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.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- grid
-
-
-
- table
-
-
-
-
- grid
role is applied to a table
element, the row
- , rowheader
, colheader
, and gridcell
roles do
- not need to be specified because they are implied by tr
, th
,
- and td
tags.
-
-
-
-
-
- aria-labelledby="ID_REF"
-
-
- table
- Refers to the heading element that labels the grid.
-
-
-
-
-
- aria-rowcount="16"
-
-
- table
-
-
-
-
- display:none
,
- which excludes them from the browser's accessibility tree.
- aria-rowcount
is when not all data is
- loaded into the DOM at one time.
-
-
-
-
-
- aria-colcount="6"
-
-
- table
-
-
-
-
- aria-rowcount
overrides the browser calculation of the
- total number of rows, the browser uses this value for the total number of columns so
- it can report the correct number when columns are hidden.
-
-
-
-
-
- aria-rowindex="INDEX_VALUE"
-
-
- tr
-
-
-
-
-
-
-
-
-
- aria-sort="ascending"
-
-
- th
- In example 2, applied when a column is sorted in ascending order.
-
-
-
-
-
- aria-sort="descending"
-
-
- th
- In example 2, applied when a column is sorted in descending order.
-
-
-
-
-
- aria-sort="none"
-
-
- th
- In example 2, applied when a column is sortable but not sorted.
-
-
-
-
-
-
- aria-colindex="INDEX_VALUE"
-
-
- th
and td
-
-
-
-
- Javascript and CSS Source Code
-
-
-
-
-
-
- HTML Source Code
- Example 1: Minimal Data Grid
-
-
-
-
-
- Example 2: Sortable Data Grid With Editable Cells
-
-
-
-
-
- Example 3: Scrollable Data Grid With Column Hiding
-
-
-
-
-
-
- Index of ARIA Design Pattern Examples
- Examples by Role
- Examples By Properties and States
- Important Note About Use of This Example
-
-
-Link Examples
- a
element to have link behaviors.
- a
element to create links whenever possible.
- Browsers provide valuable functionality for native HTML links, e.g., open the target in a new window and copy the target URL to the system clipboard.
- Examples
-
-
-
-
-
-
-
-
-
- Number
- Description
- Link
-
-
-
-
-
-
- span
element with text content.
-
-
- W3C website
-
-
-
-
-
-
-
-
- img
element with alt
attribute.
-
-
-
-
-
-
-
-
-
- CSS
- :before
content property on a span
element.
-
-
-
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- enter
-
- Activates the link.
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- link
-
-
- span
img
-
-
-
- span
element as a link
.img
element as a link
.
-
-
-
- tabindex="0"
- span
, img
Includes the link element in the page tab sequence.
-
-
-
-
- alt
- img
- Example 2: Defines the accessible name of the link.
-
-
-
-
-
-
- aria-label
- span
- Example 3: Defines the accessible name of the link.
-
- Javascript and CSS Source Code
-
- HTML Source Code
- Link 1
-
-
-
- Link 2
-
-
-
- Link 3
-
-
-
-
- (Deprecated) Collapsible Dropdown Listbox Example
- select
input with the attribute size="1"
.
- The widget consists of a button that triggers the display of a listbox.
- In its default state, the widget is collapsed (the listbox is not visible) and the button label shows the currently selected option from the listbox.
- When the button is activated, the listbox is displayed and the current option is focused and selected.
-
-
- select
element.select
with size
attribute greater than one.select
with optgroup
children.Example
-
-
- Notes
-
-
- offsetParent
.
- The example uses position: relative
on the listbox to that effect.
-
-
- focusItem
is called, the focused option will be scrolled to the top of the view if it was located above it or to the bottom if it was below it.Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
-
-
-
-
-
- Escape
- If the listbox is displayed, collapses the listbox and moves focus to the button.
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Home
- If the listbox is displayed, moves focus to and selects the first option.
-
-
- End
- If the listbox is displayed, moves focus to and selects the last option.
-
-
-
- Printable Characters
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- aria-labelledby="ID_REF1 ID_REF2"
- button
-
-
-
- Choose an element:
.
-
-
-
- aria-haspopup="listbox"
- button
Indicates that activating the button displays a listbox.
-
-
-
-
- aria-expanded="true"
- button
-
-
-
-
-
-
- listbox
-
- ul
Identifies the focusable element that has listbox behaviors and contains the listbox options.
-
-
-
-
- aria-labelledby="ID_REF"
- ul
Refers to the element containing the listbox label.
-
-
-
-
- tabindex="-1"
- ul
-
-
-
-
-
-
-
- aria-activedescendant="ID_REF"
- ul
-
-
-
- ul
element.
-
-
- option
-
- li
Identifies each selectable element containing the name of an option.
-
-
-
-
-
- aria-selected="true"
- li
-
-
-
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Listbox Example with Grouped Options
- select
element with size
greater than 1 and options grouped into categories with labeled optgroup
elements.
-
-
- select
with size
attribute greater than one.Example
-
-
-
-
-
-
- Notes
-
-
- offsetParent
.
- The example uses position: relative
on the listbox to that effect.
-
-
- focusItem
is called, the focused option will be scrolled to the top of the view if it was located above it or to the bottom if it was below it.focusItem
if a means other than a mouse click is used to change focus after scrolling.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
- Moves focus to and selects the next option.
-
-
- Up Arrow
- Moves focus to and selects the previous option.
-
-
- Home
- Moves focus to and selects the first option.
-
-
-
- End
- Moves focus to and selects the last option.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- listbox
-
- div
Identifies the focusable element that has listbox behaviors and contains the listbox options.
-
-
-
-
- aria-labelledby="ID_REF"
- div
Refers to the element containing the listbox label.
-
-
-
-
- tabindex="0"
- div
Includes the listbox in the page tab sequence.
-
-
-
-
- aria-activedescendant="ID_REF"
- div
-
-
-
- ul
element and the idref specified for aria-activedescendant
refers to the li
element that is visually styled as focused.
-
-
- group
-
- ul
Identifies a group of related options
-
-
-
-
- aria-labelledby="ID_REF"
- ul
Refers to the element containing the option group label.
-
-
-
- option
-
- li
Identifies each selectable element containing the name of an option.
-
-
-
-
-
- aria-selected="true"
- li
-
-
-
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Example Listboxes with Rearrangeable Options
-
-
- select
with size
attribute greater than one.select
with optgroup
children.Examples
- Example 1: Single-Select Listbox
-
-
-
-
-
- Notes
-
-
- aria-activedescendant
:
-
-
- listbox
element.aria-activedescendant
on the listbox
element.listbox
element does not contain any options, aria-activedescendant
does not have a value.
-
- aria-selected="true"
).aria-activedescendant
and the element that has aria-selected="true"
change.
- Example 2: Multi-Select Listbox
-
-
-
-
- Notes
-
-
- aria-activedescendant
:
-
-
- listbox
element.aria-activedescendant
on the listbox
element.listbox
element does not contain any options, aria-activedescendant
does not have a value.
-
- aria-selected="true"
).
-
-
- aria-multiselectable="true"
on the listbox
element.aria-selected
.aria-selected
set to true
and all others have it set to false
.Accessibility Features
-
-
-
-
-
-
- aria-keyshortcuts
property on the button elements.Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
- Home
-
-
-
-
-
-
-
- End
-
-
-
-
- Multiple selection keys supported in example 2
-
-
-
-
-
-
-
- Key
- Function
-
-
- Space
- changes the selection state of the focused option .
-
-
- Shift + Down Arrow
- Moves focus to and selects the next option.
-
-
- Shift + Up Arrow
- Moves focus to and selects the previous option.
-
-
- Control + Shift + Home
- Selects from the focused option to the beginning of the list.
-
-
- Control + Shift + End
- Selects from the focused option to the end of the list.
-
-
-
-
- Control + A (All Platforms)
-
- Command-A (macOS)
- selects all options in the list. If all options are selected, unselects all options.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- listbox
-
- ul
Identifies the focusable element that has listbox behaviors and contains the listbox options.
-
-
-
-
- aria-labelledby="ID_REF"
- ul
Applied to the element with the listbox role, it refers to the span containing its label.
-
-
-
-
- tabindex="0"
- ul
Applied to the element with the listbox role, it puts the listbox in the tab sequence.
-
-
-
-
- aria-multiselectable="true"
- ul
-
-
-
-
-
-
-
- aria-activedescendant="ID_REF"
- ul
-
-
-
- ul
element and the idref specified for aria-activedescendant
refers to the li
element that is visually styled as focused.aria-activedescendant=""
.
-
-
- option
-
- li
Identifies each selectable element containing the name of an option.
-
-
-
-
- aria-selected="true"
- li
-
-
-
-
-
-
-
-
- aria-selected="false"
- li
-
-
-
- Javascript and CSS Source Code
-
-
- HTML Source Code
- Example 1: Single-Select Listbox
-
-
-
-
- Example 2: Multi-Select Listbox
-
-
-
-
-
-
- Scrollable Listbox Example
- select
input where the size
attribute has a value greater than one.
-
-
- select
with optgroup
children.Example
-
-
- Notes
-
-
- offsetParent
.
- The example uses position: relative
on the listbox to that effect.
-
-
- focusItem
is called, the focused option will be scrolled to the top of the view if it was located above it or to the bottom if it was below it.focusItem
if a means other than a mouse click is used to change focus after scrolling.Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
- Moves focus to and selects the next option.
-
-
- Up Arrow
- Moves focus to and selects the previous option.
-
-
- Home
- Moves focus to and selects the first option.
-
-
-
- End
- Moves focus to and selects the last option.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- listbox
-
- ul
Identifies the focusable element that has listbox behaviors and contains the listbox options.
-
-
-
-
- aria-labelledby="ID_REF"
- ul
Refers to the element containing the listbox label.
-
-
-
-
- tabindex="0"
- ul
Includes the listbox in the page tab sequence.
-
-
-
-
- aria-activedescendant="ID_REF"
- ul
-
-
-
- ul
element and the idref specified for aria-activedescendant
refers to the li
element that is visually styled as focused.
-
-
- option
-
- li
Identifies each selectable element containing the name of an option.
-
-
-
-
-
- aria-selected="true"
- li
-
-
-
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Editor Menubar Example
- menuitemradio
and menuitemcheckbox
elements.
-
-
-
- Example
- Accessibility Features
-
-
- Smaller
menu item is disabled.
- Similarly, if the font is set to its largest size, the Larger
menu item is disabled.
- aria-hidden
attribute.
-
- Keyboard Support
- Menubar
-
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space
-
Enter
- Opens submenu and moves focus to first item in the submenu.
-
-
-
- Escape
-
-
- If a submenu is open, closes it. Otherwise, does nothing.
-
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
- Down Arrow
-
- Opens submenu and moves focus to first item in the submenu.
-
-
-
- Up Arrow
-
- Opens submenu and moves focus to last item in the submenu.
-
-
-
- Home
-
- Moves focus to first item in the menubar.
-
-
-
- End
-
- Moves focus to last item in the menubar.
-
-
-
-
- Character
-
-
-
-
-
- Submenu
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space
-
Enter
- Activates menu item, causing action to be executed, e.g., bold text, change font.
-
-
-
- Escape
-
-
-
-
-
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
-
-
- Home
-
- Moves focus to the first item in the submenu.
-
-
-
- End
-
- Moves focus to the last item in the submenu.
-
-
-
-
- Character
-
-
-
-
-
- Role, Property, State, and Tabindex Attributes
- Menubar
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- menubar
-
-
-
- ul
-
-
-
-
- menubar
container for a set of menuitem
elements.
-
-
-
-
- aria-label="string"
-
-
-
- ul
-
-
-
-
- menubar
.
-
-
-
-
- menuitem
-
-
-
- span
-
-
-
-
-
-
-
-
-
- tabindex="-1"
-
-
- span
-
- Makes the
- menuitem
element keyboard focusable but
- not part of the Tab sequence of the page.
-
-
-
-
-
- tabindex="0"
-
-
- span
-
-
-
-
- menuitem
element keyboard focusable and
- part of the tab sequence of the page.
- menuitem
in the menubar
has tabindex="0"
.
- tabindex="0"
.
-
-
-
-
-
- aria-haspopup="true"
-
-
- span
-
- Indicates that the
- menuitem
has a submenu.
-
-
-
-
-
- aria-expanded="true"
-
-
- span
-
-
-
-
- aria-expanded
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
-
-
-
-
-
- aria-expanded="false"
-
-
- span
-
-
-
-
- aria-expanded
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
-
-
-
-
-
-
- aria-hidden="true"
-
-
- span
-
- Removes the character entities used to represent the down arrow icons for parent menu items from the accessibility tree to prevent them from being included in the accessible name of the menu item.
-
- Submenu
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- menu
-
-
-
- ul
-
-
-
-
-
-
-
-
-
- aria-label="string"
-
-
- ul
-
- Defines an accessible name for the
- menu
.
-
-
-
-
- menuitem
-
-
-
- li
-
-
-
-
-
-
-
-
-
- tabindex="-1"
-
-
- li
-
- Makes the item focusable but not part of the page tab sequence.
-
-
-
-
-
-
- aria-disabled="false"
-
-
- li
-
- Used on the font size "Smaller" and "Larger" options to indicate they are active.
-
-
-
-
-
-
- aria-disabled="true"
-
-
- li
-
- Used on the font size "Smaller" and "Larger" options to indicate one of the options is not active because the largest or smallest font has been selected.
-
-
-
-
-
- menuitemcheckbox
-
-
-
- li
-
-
-
-
- menuitemcheckbox
.
-
-
-
-
- tabindex="-1"
-
-
- li
-
- Makes the menuitemcheckbox focusable but not part of the page tab sequence.
-
-
-
-
-
-
- aria-checked="true"
-
-
- li
-
-
-
-
- menuitemcheckbox
is checked.
- aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
-
-
-
-
-
- aria-checked="false"
-
-
- li
-
-
-
-
- menuitemcheckbox
is NOT checked.
- aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
-
-
-
-
-
- aria-hidden="true"
-
-
- span
-
- Removes the character entities that visually represent the checked state of
- menuitemcheckbox
elements from the accessibility tree to prevent them from being included in the accessible name of the menu item.
-
-
-
-
- separator
-
-
-
- li
-
-
-
-
- menuitemradio
or menuitemcheckbox
elements.
-
-
-
- group
-
-
-
- ul
-
-
-
-
- menuitemradio
elements.
- aria-setsize
and aria-posinset
.
-
-
-
-
-
- aria-label="string"
-
-
- ul
-
- Provides an accessible name for the group of menu items.
-
-
-
-
-
- menuitemradio
-
-
-
- li
-
-
-
-
- menuitemradio
element.
- menu
element; a group
element is not necessary.
-
-
-
-
-
- tabindex="-1"
-
-
- li
-
- Makes the menuitemradio focusable but not part of the page tab sequence.
-
-
-
-
-
-
- aria-checked="true"
-
-
- li
-
-
-
-
- menuitemradio
is checked.
- aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
-
-
-
-
-
- aria-checked="false"
-
-
- li
-
-
-
-
- menuitemradio
is NOT checked.
- aria-checked
value using CSS attribute selectors and hidden from screen readers with aria-hidden="true"
.
-
-
-
-
-
-
- aria-hidden="true"
-
-
- span
-
- Removes the character entities that visually represent the checked state of
- menuitemradio
elements from the accessibility tree to prevent them from being included in the accessible name of the menu item.
- Textarea
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
-
-
- aria-label="string"
-
-
- textarea
-
- Defines an accessible name for the
- textarea
.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Navigation Menubar Example
-
-
- menubar
pattern requires complex functionality that is unnecessary for typical site navigation that is styled to look like a menubar with expandable sections or fly outs
.menubar
and menu
roles.
-
-
-
- Example
- Mythical University
- Accessibility Features
-
-
-
-
-
-
-
-
- currentcolor
value for the fill
and stroke
properties of the SVG polygon
element is used to synchronize the color with text content.
- If specific colors are used to specify the fill
and stroke
properties, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the icon and the background or even make the icon invisible if its color matches the high contrast mode background.
- nav
element that has an aria-label
that matches the label on the menubar.Keyboard Support
- Menubar
-
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space
-
Enter
-
-
-
-
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
- Down Arrow
-
- Opens submenu and moves focus to first item in the submenu.
-
-
-
- Up Arrow
-
- Opens submenu and moves focus to last item in the submenu.
-
-
-
- Home
-
- Moves focus to first item in the menubar.
-
-
-
- End
-
- Moves focus to last item in the menubar.
-
-
-
-
- Character
-
-
-
-
-
- Submenu
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space
-
Enter
-
-
-
-
-
-
-
- Escape
-
-
-
-
-
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
-
-
- Home
-
- Moves focus to the first item in the submenu.
-
-
-
- End
-
- Moves focus to the last item in the submenu.
-
-
-
-
- Character
-
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
- Landmarks
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- banner
-
- header
-
-
-
- banner
role declaration is only necessary because it is an example that is nested inside the content of this page.
- In an actual website, the header element would be a top level element, i.e., it would have the body as its scope.
- If the scope of the header element were body, browsers would automatically treat the header as an ARIA banner, so the header would not need role="banner"
.
-
-
- navigation
-
- nav
- Identifies the region containing the mythical university navigation.
-
-
-
-
-
- aria-label="Mythical University"
- nav
- Provides an accessible name for the
- navigation
landmark that describes the purpose of the navigation.
-
-
-
- region
-
- section
-
-
-
- main
landmark, but since this page already has a main landmark, role region
is used to avoid having two main
landmarks on the page.
-
-
-
- aria-labelledby="idref"
- section
- Provides the region with an accessible name from the
- h1
element.
-
-
-
-
- contentinfo
-
- footer
-
-
-
- contentinfo
role declaration is only necessary because the footer is an example that is nested inside the content of this page.
- In an actual website, the footer element would be a top level element, i.e., it would have the body as its scope.
- If the scope of the footer element were body, browsers would automatically treat the footer as a ARIA contentinfo
landmark, so the footer would not need role="contentinfo"
.
- Menubar
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- menubar
-
-
-
- ul
-
-
-
-
- menubar
container for a set of menuitem
elements.
-
-
-
-
- aria-label="string"
-
-
- ul
-
-
-
-
- menubar
.
-
-
-
-
- menuitem
-
-
-
- a
-
-
-
-
- a
element.
-
-
-
-
- tabindex="-1"
-
-
- a
-
- Makes the
- a
element keyboard focusable, but not part of the tab sequence.
-
-
-
-
-
- tabindex="0"
-
-
- a
-
-
-
-
- tabindex="0"
.tabindex="0"
.
-
-
-
-
- aria-current="page"
-
-
- a
-
-
-
-
- title
attribute with the text content of "Contains current page link" to indicate to screen reader users the menu item contains the current page link.
-
-
-
-
- aria-haspopup="true"
-
-
- a
- Indicates the menuitem has a submenu.
-
-
-
-
-
- aria-expanded="true"
-
-
- a
- Indicates the submenu is open.
-
-
-
-
-
- aria-expanded="false"
-
-
- a
- Indicates the submenu is closed.
-
-
-
-
-
- none
-
-
-
- li
-
-
-
-
- listitem
role of the li
element.ul
is serving as a menu
so the li
elements are not in their required list context.Submenu
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- menu
-
-
-
- ul
- Identifies the element as a menu container for a set of menu items.
-
-
-
-
-
- aria-label="string"
-
-
- ul
-
-
-
-
- menu
.
-
-
-
-
- menuitem
-
-
-
- a
-
-
-
-
- a
element.
-
-
-
-
- tabindex="-1"
-
-
- a
- Keeps the
- a
element focusable but removes it from the Tab sequence.
-
-
-
-
- aria-haspopup="true"
-
-
- a
- Indicates the menu item has a submenu.
-
-
-
-
-
- aria-expanded="true"
-
-
- a
- Indicates the submenu is open.
-
-
-
-
-
- aria-expanded="false"
-
-
- a
- Indicates the submenu is closed.
-
-
-
-
-
- none
-
-
-
- li
-
-
-
-
- listitem
role of the li
element.ul
is serving as a menu
so the li
elements are not in their required list context.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
-
-
- Meter Example
- Example
- Central Processing Unit (CPU) Usage
- Keyboard Support
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- meter
-
-
- div
-
-
-
-
- meter
.
-
-
-
- aria-valuemin="NUMBER"
- div
Specifies the minimum value the meter can have.
-
-
-
-
- aria-valuemax="NUMBER"
- div
Specifies the maximum value the meter can have.
-
-
-
-
- aria-valuenow="NUMBER"
- div
Specifies the current value of the meter.
-
-
-
-
-
- aria-labelledby
- div
Identifies the element that provides the accessible name of the
- meter
.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
-
-
-
- Rating Radio Group Example
-
-
-
- aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-activedescendant
for managing keyboard focus.tabindex
for managing keyboard focus.Example
- Accessibility Features
-
-
-
-
- currentcolor
value for the stroke
property of the inline SVG polygon
to draw the star borders and rect
element used to draw the focus ring border.
- To make the background of the polygon
and rect
elements match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
- If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the star and the background or even make them invisible if their color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
-
-
-
-
- radio
button in the radiogroup
.radio
button is not checked, focus moves to the first radio
button in the group.
-
- Space
-
-
-
-
- radio
button with focus is not checked, changes the state to checked
.
-
- Down arrow
-
Right arrow
-
-
-
- radio
button in the group.radio
button, moves focus to the first radio
button.
-
-
- Up arrow
-
Left arrow
-
-
-
- radio
button in the group.radio
button, moves focus to and checks the last radio
button.Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attributes
- Element
- Usage
-
-
-
-
- none
-
-
-
- svg
-
- The use of the
- none
role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
-
-
-
- radiogroup
-
- div
-
-
-
- div
element as a container for a group of radio
buttons.
-
-
-
- aria-labelledby="ID_REFERENCE"
- div
Refers to the element that contains the label of the radio group.
-
-
-
- radio
-
- g
Identifies the
- g
element as an ARIA radio
button.
-
-
-
- aria-label="name"
- g
- Defines an accessible name that identifies the number of stars associated with the radio button (e.g. "one star", two stars", ..).
-
-
-
-
-
- tabindex="-1"
- g
-
-
-
-
-
-
-
- tabindex="0"
- g
-
-
-
-
-
-
-
- aria-checked="false"
- g
-
-
-
- radio
buttons which are not checked.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo-element is used to indicate visual state of unchecked radio buttons to support high contrast settings in operating systems and browsers.
-
-
-
-
- aria-checked="true"
- g
-
-
-
- radio
button which is checked.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.::before
pseudo-element is used to indicate visual state of checked radio buttons to support high contrast settings in operating systems and browsers.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Color Viewer Slider Example
-
-
- aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
- Accessibility Features
-
-
- group
labeled by the heading that labels the color viewer.currentcolor
value for the stroke
property is used for the SVG rect
elements to synchronize the border color with text content.
- If specific colors were used to specify the stroke
property, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background.
- NOTE: The SVG elements need to be inline to use currentcolor
.
- Keyboard Support
-
-
-
-
-
-
-
-
- Key
- Function
-
-
- Right Arrow
- Increases slider value one step.
-
-
- Up Arrow
- Increases slider value one step.
-
-
- Left Arrow
- Decreases slider value one step.
-
-
- Down Arrow
- Decreases slider value one step.
-
-
- Page Up
- Increases slider value multiple steps. In this slider, jumps ten steps.
-
-
- Page Down
- Decreases slider value multiple steps. In this slider, jumps ten steps.
-
-
- Home
- Sets slider to its minimum value.
-
-
-
- End
- Sets slider to its maximum value.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- group
-
- div
-
-
-
- div
as a group.
-
-
-
- aria-labelledby="IDREF"
- div
Refers to the heading element that provides the accessible name for the group.
-
-
-
-
- slider
-
-
-
- div
-
-
-
-
- div
that represents the movable thumb because it is the operable element that controls the slider value.
-
-
-
-
- tabindex="0"
-
-
- div
- Includes the slider thumb in the page tab sequence.
-
-
-
-
-
- aria-valuemax="255"
-
-
- div
- Specifies the maximum value of the slider.
-
-
-
-
-
- aria-valuemin="0"
-
-
- div
- Specifies the minimum value of the slider.
-
-
-
-
-
- aria-valuenow="NUMBER"
-
-
- div
- Indicates the current value of the slider.
-
-
-
-
-
- aria-labelledby="IDREF"
-
-
- div
- Refers to the element containing the name of the slider.
-
-
-
-
-
- aria-hidden="true"
- svg
Removes the SVG elements from the accessibility tree. Some assistive technologies will describe the SVG elements, unless they are explicitly hidden.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Rating Slider Example
-
-
- aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
- Accessibility Features
-
-
- aria-valuetext
property to communicate both the current and maximum values.
- However, since repeating the maximum value every time the slider value changes is potentially distracting, the maximum value is included in aria-valuetext
only when the slider is initialized and when the thumb loses keyboard focus.
- currentcolor
value for the stroke
property of each inline SVG polygon
element.
- To enable the high contrast background color to be the used as the contrasting color when a star is not fully or partially filled, the fill-opacity
attribute of the polygon
is set to zero.
- If specific colors were used to specify the stroke
and fill
properties, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background.
-
Note: The SVG element needs to have the CSS forced-color-adjust
property set to the value auto
for the currentcolor
value to be updated in high contrast modes.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
-
- Key
- Function
-
-
- Right Arrow
- Increases slider one half star.
-
-
- Up Arrow
- Increases slider one half star.
-
-
- Left Arrow
- Decreases slider one half star.
-
-
- Down Arrow
- Decreases slider one half star.
-
-
- Page Up
- Increases slider value multiple steps. In this slider, jumps one star.
-
-
- Page Down
- Decreases slider value multiple steps. In this slider, jumps one star.
-
-
- Home
- Sets slider to its minimum value, no stars.
-
-
-
- End
- Sets slider to its maximum value, five stars.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- slider
-
-
-
- div
-
-
-
-
- div
that represents the movable thumb because it is the operable element that controls the slider value.
-
-
-
-
- tabindex="0"
-
-
- div
- Includes the slider thumb in the page tab sequence.
-
-
-
-
-
- aria-valuemax="5"
-
-
- div
- Specifies the maximum value of the slider.
-
-
-
-
-
- aria-valuemin="0"
-
-
- div
- Specifies the minimum value of the slider.
-
-
-
-
-
- aria-valuenow="NUMBER"
-
-
- div
- Indicates the current value of the slider.
-
-
-
-
-
- aria-valuetext="STRING"
-
-
- div
-
-
-
-
- 3 of 5 stars
.
-
-
-
-
- aria-labelledby="IDREF"
-
-
- div
- Refers to the element containing the name of the slider.
-
-
-
-
-
- aria-hidden="true"
- svg
Removes the SVG elements from the accessibility tree to prevent assistive technologies from presenting them as elements separate from the slider.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Media Seek Slider Example
- aria-valuetext
to provide assistive technology users with meaningful names for numeric values.
- In this case, the value of the control is the position in seconds.
- For example, if the play position were 4 minutes and 3 seconds from the start, the slider value is 243.
- If aria-valuetext
were not used, assistive technology users would be told that the position is 243
, which is significantly more difficult to comprehend than 4 minutes, 3 seconds
.
- So, the code converts the slider value to a string that communicates the position in minutes and seconds and provides that value via aria-valuetext
.
-
-
-
- aria-orientation
to specify vertical orientation and aria-valuetext
to communicate unit of measure for a temperature input.aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.Example
- Accessibility Features
-
-
- aria-valuetext
property to communicate both the current and maximum values.
- However, since repeating the maximum value every time the slider value changes is potentially distracting, the maximum value is included in aria-valuetext
only when the slider is initialized and when the thumb loses keyboard focus.
- currentcolor
value for the stroke
property of the inline SVG rect
element used to draw the focus ring border.
- To make the background of the rect
match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
- If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Right Arrow
-
- Increases slider value one step.
-
-
-
- Up Arrow
-
- Increases slider value one step.
-
-
-
- Left Arrow
-
- Decreases slider value one step.
-
-
-
- Down Arrow
-
- Decreases slider value one step.
-
-
-
- Page Up
-
- Increases slider value 15 steps.
-
-
-
- Page Down
-
- Decreases slider value 15 steps.
-
-
-
- Home
-
- Sets slider to its minimum value.
-
-
-
-
- End
-
- Sets slider to its maximum value.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- none
-
-
-
- svg
-
- The use of the
- none
role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
-
-
-
-
- slider
-
-
-
- g
-
-
-
-
- g
element that represents as the movable thumb because it is the operable element that represents the slider value.
-
-
-
-
- tabindex="0"
-
-
- g
- Includes the slider thumb in the page tab sequence.
-
-
-
-
-
- aria-valuemax="NUMBER"
-
-
- g
- Specifies a numeric value that is the maximum value the slider can have.
-
-
-
-
-
- aria-valuemin="NUMBER"
-
-
- g
- Specifies a numeric value that is the minimum value the slider can have.
-
-
-
-
-
- aria-valuenow="NUMBER"
-
-
- g
- A numeric value that is the current value of the slider.
-
-
-
-
-
- aria-valuetext="STRING"
-
-
- g
-
-
-
-
-
-
-
-
-
- aria-labelledby="IDREF"
-
-
- g
- Refers to the element containing the name (e.g. label) of the slider.
-
-
-
-
-
-
- aria-hidden="true"
-
-
- rect
- Removes the SVG
- rect
element from the accessibility tree to prevent assistive technologies from presenting it as an image separate from the slider.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Vertical Temperature Slider Example
- aria-orientation
to specify vertical orientation and use of aria-valuetext
to convey unit of measure for numeric values to assistive technology users by appending degrees Celsius
to the current value.
-
-
-
- aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale.aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.Example
- Accessibility Features
-
-
- currentcolor
value for the stroke
property of the inline SVG rect
element used to draw the focus ring border.
- To make the background of the rect
match the high contrast background color, the fill-opacity
attribute of the rect
is set to zero.
- If specific colors were instead used to specify the stroke
and fill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust
property set to auto
for the currentcolor
value to be updated in high contrast mode.
- Some browsers do not use auto
for the default value.
- Keyboard Support
-
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Right Arrow
-
- Increases slider value one step.
-
-
-
- Up Arrow
-
- Increases slider value one step.
-
-
-
- Left Arrow
-
- Decreases slider value one step.
-
-
-
- Down Arrow
-
- Decreases slider value one step.
-
-
-
- Page Up
-
- Increases temperature slider value multiple steps. In this slider, jumps twenty steps (e.g. 2°C).
-
-
-
- Page Down
-
- Decreases temperature slider value multiple steps. In this slider, jumps twenty steps (e.g. 2°C).
-
-
-
- Home
-
- Sets slider to its minimum value.
-
-
-
-
- End
-
- Sets slider to its maximum value.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- none
-
-
-
- svg
-
- ensures assistive technologies do not present the SVG element as an image or any other type of meaningful element.
-
-
-
-
-
- slider
-
-
-
- g
-
-
-
-
- g
element that represents the movable thumb because it is the operable element that receives focus and conveys the value.
-
-
-
-
- tabindex="0"
-
-
- g
- Includes the slider thumb in the page tab sequence.
-
-
-
-
-
- aria-orientation
-
-
- g
-
- Indicates the slider is vertically oriented.
-
-
-
-
-
-
- aria-valuemax="NUMBER"
-
-
- g
- Specifies the numeric value that is the maximum allowed value of the slider.
-
-
-
-
-
- aria-valuemin="NUMBER"
-
-
- g
- Specifies the numeric value that is the minimum allowed value of the slider.
-
-
-
-
-
- aria-valuenow="NUMBER"
-
-
- g
- A numeric value that is the current value of the slider.
-
-
-
-
-
- aria-valuetext="STRING"
-
-
- g
-
- Provides a more user-friendly name for the current value of the slider by combining the current value with the string
- degrees Celsius
.
-
-
-
-
-
- aria-labelledby="IDREF"
-
-
- g
- Refers to the element containing the name (e.g. label) of the slider.
-
-
-
-
-
-
- aria-hidden="true"
-
-
- rect
- Removes the SVG
- rect
element from the accessibility tree to prevent screen readers from presenting it as a meaningful image.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Date Picker Spin Button Example
-
-
- Example
- Accessibility Features
-
-
- div
that contains a date string that reflects the current values of the three spin buttons.
- This enables screen reader users to easily perceive the date represented by the three buttons without having to navigate to all three buttons and remember the value of each one; it is the screen reader user equivalent to seeing the date at a glance.
- aria-valuetext
to properly pronounce the day. e.g. first, second, third ...aria-valuetext
to properly pronounce the month instead of the numeric value. e.g. January, February, ...div
with role spinbutton
so they can be separately focusable by users of touch screen readers.
- However, they are excluded from the page Tab sequence with tabindex="-1"
because they are redundant with the arrow key support provided to keyboard users.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
-
-
-
-
- Day
spin button and the value is the first day of the month, changes value to the last day of the month.Month
spin button and the value is January
, changes value to December
.
-
- Up Arrow
-
-
-
-
- Day
spin button and the value is the last day of the month, changes value to the first day of the month.Month
spin button and the value is December
, changes value to January
.
-
- Page Down
-
-
-
-
- Day
spin button and the value is the fifth day of the month or less, changes value to the last day of the month.Month
spin button and the value is the fifth month of the year or less, changes value to December
.
-
- Page Up
-
-
-
-
- Day
spin button and the value is any of the last five days of the month, changes value to the first day of the month.Month
spin button and the value is any of the last five months of the year, changes value to January
.
-
- Home
- Decreases to minimum value.
-
-
-
- End
- Increases to maximum value.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- group
-
- div
-
-
-
- div
as a group.
-
-
-
- aria-labelledby="IDREFs"
- div
-
-
-
- div
elements that provide the accessible name for the group.Choose a Date
.div
that contains a string specifying the current date represented by the values of the three spin buttons, which is updated by JavaScript as users change the values of the spin buttons.
-
-
- spinbutton
-
- div
Identifies the
- div
element as a spinbutton
.
-
-
-
- aria-label="NAME_STRING"
- div
Defines the accessible name for each spin button (e.g.
- day
, month
and year
).
-
-
-
- aria-valuenow="NUMBER"
- div
-
-
-
-
-
-
-
-
- aria-valuetext="DAY_NUMBER_STRING"
or
- aria-valuetext="MONTH_STRING"
-
- div
-
-
-
- Day
spin button, provides screen reader users with a friendlier pronunciation of the number of the day of the month (i.e. first
instead of one
).Month
spin button, provides screen reader users with a friendlier announcement of the month (i.e., January
instead of one
).
-
-
-
- aria-valuemin="NUMBER"
- div
Indicates the minimum allowed value for the spin button.
-
-
-
-
- aria-valuemax="NUMBER"
- div
-
-
-
- Day
spin button, this property is updated based on the value of the Month
spin button.
-
-
-
- aria-hidden="true"
-
-
-
- div.next
div.previous
For assistive technology users, hides the text showing the next and previous values that is displayed adjacent to the up and down arrow icons since it would otherwise add superfluous elements to the screen reader reading order that are likely to be more confusing than helpful.
-
-
-
-
- aria-label="NAME_STRING"
- button
Defines the accessible name for each increase and decrease button (
- Next Day
, Previous Day
, Next Month
, Previous Month
, Next year
, and Previous Year
).
-
-
-
-
- tabindex="-1"
- button
Removes the decrease and increase buttons from the page Tab sequence while keeping them focusable so they can be accessed with touch-based assistive technologies.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Switch Example Using HTML Button
- button
as a switch element and using an SVG
element to provide graphical rendering of switch states.
- It also demonstrates using the group
role to present multiple switches in a labeled group.
-
-
-
- div
element that turns a notification preference on and off.input[type="checkbox"]
elements that turn accessibility preferences on and off.Example
- Environmental Controls
- Accessibility Features
-
-
- Environmental Controls
are a group of two switches, the switches are wrapped in a group
labeled by the heading that labels the set of switches.on
or off
) is displayed adjacent to the graphical state indicator.
- CSS attribute selectors ensure the label displayed is synchronized with the value of the aria-checked
attribute.
- NOTE: To prevent redundant announcement of the state by screen readers, the text indicators of state are hidden from assistive technologies with aria-hidden
.
-
-
- :hover
and :focus
pseudo-classes:
-
-
- currentcolor
value for the stroke
and fill
properties is used to synchronize the colors with text content.
- If specific colors were used to specify the stroke
and fill
properties, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background.
- The fill-opacity
of the container rect
is set to zero for the background color of the page to provide the contrasting color to the stroke
and fill
colors.
-
NOTE: The SVG elements need to set the CSS forced-color-adjust
property to auto
for some browsers to support the currentcolor
value.
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
-
-
-
-
- switch
.
-
-
- Space, Enter
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- switch
-
- button
Identifies the
- button
element as a switch
.
-
-
-
- aria-checked="false"
- button
-
-
-
- switch
is off.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
-
-
-
- aria-checked="true"
- button
-
-
-
- switch
is on.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
-
-
-
- aria-hidden="true"
- span.on
and span.off
-
-
-
- on
and off
that appear to the right of the switch from the accessible name of the switch.
-
-
-
-
- h3
Provides a grouping label for the group of switches.
-
-
-
- group
-
- div
Identifies the
- div
element as a group
container for the switches.
-
-
-
-
- aria-labelledby
- div
References the
- h3
element to define the accessible name for the group of switches.Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
-
- Switch Example Using HTML Checkbox Input
- input[type="checkbox"]
as the switch element and using CSS borders to provide graphical rendering of switch states.
- It also demonstrates using the HTML fieldset
and legend
elements to present multiple switches in a labeled group.
-
-
-
- div
element that turns a notification preference on and off.button
elements that turn lights on and off.Example
- Accessibility Features
-
-
- Accessibility Preferences
, the switches are wrapped in a fieldset
element labeled with a legend
element.
- on
or off
) is displayed adjacent to the graphical state indicator.
- CSS attribute selectors ensure the label displayed is synchronized with the value of the input
.
- NOTE: To prevent redundant announcement of the state by screen readers, the text indicators of state are hidden from assistive technologies with aria-hidden
.
-
-
- :hover
pseudo-class and onfocus
and onblur
event handlers:
-
-
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
- Moves keyboard focus to the
- switch
.
-
-
- Space
- Toggles the state of the switch between on and off.
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- switch
-
- input[type="checkbox"]
-
-
-
- switch
.label
element.
-
-
-
-
- aria-hidden="true"
- span.on
and span.off
-
-
-
- on
and off
that appear to the right of the switch from the accessible name of the switch.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Switch Example
- div
element for the switch and CSS borders to provide graphical rendering of switch states.
-
-
-
- button
elements that turn lights on and off.input[type="checkbox"]
elements that turn accessibility preferences on and off.Example
- Accessibility Features
-
-
- on
or off
) is displayed adjacent to the graphical state indicator.
- CSS attribute selectors ensure the label displayed is synchronized with the value of the aria-checked
attribute.
- NOTE: To prevent redundant announcement of the state by screen readers, the text indicators of state are hidden from assistive technologies with aria-hidden
.
-
-
- :hover
and :focus
pseudo-classes:
-
-
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
-
-
-
-
- switch
.
-
-
- Space
-
Enter
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- switch
-
- div
Identifies the
- div
element as a switch
.
-
-
-
- tabindex="0"
- div
Includes the switch in the page Tab sequence.
-
-
-
-
- aria-checked="false"
- div
-
-
-
- switch
is off.[aria-checked="false"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
-
-
-
- aria-checked="true"
- div
-
-
-
- switch
is on.[aria-checked="true"]
) are used to synchronize the visual states with the value of the aria-checked
attribute.
-
-
-
-
- aria-hidden="true"
- span.on
and span.off
-
-
-
- on
and off
that appear to the right of the switch from the accessible name of the switch.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Sortable Table Example
- aria-sort
attribute is set on the column header of the currently sorted column, and the header text of sortable columns is wrapped in a button
element.
- One column, the Address
column is not sortable.
-
-
-
- Example Option
-
- ♢
) to the header of each column that can be sorted but is not currently sorted.
- Some sortable tables add an icon to unsorted columns to help users distinguish sortable columns from columns that cannot be sorted.
- It is important that the shape of the unsorted icon differ in more than just color and size from the icons that indicate sort direction (e.g. '▼' and '▲') so people with visual impairments can easily distinguish them.
- Example
-
-
-
-
-
-
-
-
-
-
-
-
- Address
-
-
-
-
- Fred
- Jackson
- Canary, Inc.
- 123 Broad St.
- 56
-
-
- Sara
- James
- Cardinal, Inc.
- 457 First St.
- 7
-
-
- Ralph
- Jefferson
- Robin, Inc.
- 456 Main St.
- 513
-
-
-
- Nancy
- Jensen
- Eagle, Inc.
- 2203 Logan Dr.
- 3.5
- Accessibility Features
-
-
- :hover
and :focus
pseudo-classes:
-
-
- Keyboard Support
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- aria-sort="value"
- th
-
-
-
- aria-sort
attribute is removed and set on the newly sorted column.ascending
" indicates the data cells in the column are sorted in ascending order.descending
" indicates the data cells in the column are sorted in descending order.
-
-
-
-
- aria-hidden="true"
- span
Removes the character entities used for sort icons from the accessibility tree to prevent them from being included in the accessible name of the sort buttons.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- Table Example
- table
element is recommended.
-
-
-
- aria-sort
in the headers of sortable columns.Example
- Keyboard Support
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- table
-
- div
Identifies the element containing the table structure.
-
-
-
-
-
- aria-label="Students"
-
- div
Provides an accessible name for the table.
-
-
-
-
-
- aria-describedby="IDREF"
-
- div
Refers to the element that serves as the caption for the table.
-
-
-
- rowgroup
-
- div
-
-
-
-
-
-
- row
-
- div
Identifies each element that contains the cells for a row.
-
-
-
- columnheader
-
- span
Identifies elements that serve as a cell containing a column label.
-
-
-
-
- cell
-
- span
Identifies elements containing content for a single cell.
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
- Toolbar Help
-
-Toolbar Example
- Example
-
-
- Accessibility Features
- Keyboard Features
-
-
-
-
- Focus Styling
-
-
- Button Popup Labels
-
-
- Keyboard Support
- Toolbar
-
-
-
-
-
-
-
- Key
- Function
-
-
- Tab
-
-
-
-
-
-
- Right Arrow
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
- Home
- Moves focus to the first control.
-
-
- End
- Moves focus to the last control.
-
-
-
- ESC
- If a button popup label is visible, hides it.
- Toggle Buttons (Bold, Italic, Underline)
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Enter
-
SpaceToggle the pressed state of the button.
- Radio Group (Text Alignment)
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
Space
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
-
- Up Arrow
-
-
-
-
- Button (Cut, Copy, Paste)
- aria-disabled
instead of the HTML disabled
attribute.
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Enter
-
SpaceIf the button is enabled, execute the action associated with the button. Otherwise, do nothing.
- Menu Button (Font Family)
-
-
-
-
-
-
-
- Key
- Function
-
-
-
-
- Enter
-
- Space
- Down Arrow
- Up Arrow
-
- Open the menu and place focus on a menu item.
- In this implementation, the focus is set on the currently selected font family when the menu opens.
-
- Menu (Font Family)
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
-
SpaceActivate the menu item, close the menu, and place focus on the menu button.
-
-
- Down Arrow
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
-
- ESC
- Closes the menu and moves focus to the menu button.
- Spin Button (Font Size)
-
-
-
-
-
-
-
- Key
- Function
-
-
- Down Arrow
- Decreases the font size of the text in the
- textarea
by 1 point.
-
- Up Arrow
- Increases the font size of the text in the
- textarea
by 1 point.
-
- Page Down
- Decreases the font size of the text in the
- textarea
by 5 points.
-
-
- Page Up
- Increases the font size of the text in the
- textarea
by 5 points.Checkbox (Night Mode)
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Space
- Toggles the state of the checkbox.
- Link (Help)
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Enter
-
SpaceActivate the link.
- Role, Property, State, and Tabindex Attributes
- Toolbar
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- toolbar
-
- div
-
-
-
- toolbar
.
-
-
-
-
- aria-label="Text Formatting"
-
- div
Provides the toolbar with an accessible name of "Text Formatting".
-
-
-
-
-
- aria-controls="IDREF"
-
- div
Set to a value that references the text area, indicating the toolbar controls the text area.
-
-
-
-
-
- tabindex="-1"
-
-
- button
, div
, input[type="checkbox"]
, a
-
-
-
-
-
-
-
-
-
-
- tabindex="0"
-
-
- button
, div
, input[type="checkbox"]
, a
-
-
-
-
- Toggle Buttons (Bold, Italic, Underline)
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- aria-pressed="true"
- button
Indicates the button is a toggle and that the styling controlled by the button has been applied.
-
-
-
-
- aria-pressed=
false
- button
Indicates the button is a toggle and that the styling controlled by the button has NOT been applied.
-
-
-
-
-
- aria-hidden="true"
- span
Hides the icon character from being included in the accessible name.
- Radio Group (Text Alignment)
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- radiogroup
-
- div
Identifies the
- div
element as a container for group of radio buttons.
-
-
-
- aria-label="Text Alignment"
- div
Defines the accessible name for the group of radio buttons as "Text Alignment".
-
-
-
- radio
-
- button
-
-
-
- button
element as a radio
button.button
element.
-
-
-
- aria-checked="true"
- button
-
-
-
- aria-checked
set to true
at any given time.
-
-
-
- aria-checked="false"
- button
-
-
-
- aria-checked
set to false
.
-
-
-
-
- aria-hidden="true"
- span
Hides the icon character from being included in the accessible name.
- Button (Cut, Copy, Paste)
- aria-disabled
instead of the HTML disabled
attribute.
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- aria-disabled="true"
- button
Set when the button is disable to inform assistive technologies of the disabled state.
-
-
-
-
-
- aria-disabled="false"
- button
Set when the function provided by the button is available.
- Menu Button (Font Family)
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- aria-label="Font: FONT_FAMILY_NAME"
- button
-
-
-
- Font:
with the name of the font family currently checked in the menu.
-
-
-
- aria-haspopup="true"
- button
-
-
-
- button
opens a menu.menubutton
, most platform accessibility APIs have a menubutton
role.
- On those platforms, assistive technologies identify buttons with aria-haspopup
set to either true
or menu
as menu buttons.
-
-
-
-
- aria-controls="IDREF"
- button
-
-
-
- menu
.
-
-
-
-
- aria-expanded="true"
- button
-
-
-
- aria-expanded
attribute is removed when the menu is closed.Menu (Font Family)
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
-
- menu
-
-
- ul
Identifies the
- ul
element as a menu
.
-
-
-
- aria-label="Font Family"
- ul
Defines the accessible name for the menu as "Font Family".
-
-
-
- menuitemradio
-
- li
-
-
-
- li
element as a menuitemradio
.li
element provides the accessible name of the menuitemradio
.
-
-
-
-
- aria-checked="true"
- li
-
-
-
- menuitemradio
to indicate the item is checked, informing users which font is applied to the text area .
-
-
-
-
- aria-checked="false"
- li
-
-
-
- menuitemradio
to indicate the items are NOT checked.
-
-
-
-
- tabindex="-1"
-
- li
-
-
-
-
- menuitemradio
element focusable so DOM focus can be set on the menu item.Spin Button (Font Size)
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- spinbutton
-
- div
Identifies the
- div
element as a spinbutton
.
-
-
-
- aria-label="Font size in points"
- div
Defines the accessible name for the spin button as "Font size in points".
-
-
-
-
- aria-valuenow="NUMBER_POINTS"
- div
-
-
-
-
-
-
-
- aria-valuetext="NUMBER_POINTS Points"
- div
-
-
-
- NUMBER_POINTS
is updated by JavaScript as the user adjusts the value of the spin button.Points
, e.g., 10 Points
.
-
-
-
- aria-valuemin="8"
- div
Indicates the minimum allowed value for the spin button, i.e., smallest supported font size.
-
-
-
-
-
- aria-valuemax="40"
- div
Indicates the maximum allowed value for the spin button, i.e., largest supported font size.
- Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
-
- Treegrid Email Inbox Example
-
-
- Example Usage Options
-
-
-
- Useful when the desired experience is for the treegrid to act primarily like a tree where each row is treated like a node in a tree,
- but it is still possible for users to navigate across the cells in a row.
-
- Useful when the desired experience is for the treegrid to act primarily like a grid where arrow keys move among cells,
- but it is still possible for users to focus a row and then start navigating the structure like a tree.
-
- Useful when the desired experience is that the treegrid act primarily like a grid and there is no need to focus complete rows.
-
-
- Example
-
-
-
-
-
-
- Subject
- Summary
- Email
-
-
- Treegrids are awesome
- Want to learn how to use them?
- aaron@thegoogle.rocks
-
-
- re: Treegrids are awesome
- I agree with you, they are the shizzle
- joe@blahblahblah.blahblah
-
-
- re: Treegrids are awesome
- They are great for showing a lot of data, like a grid
- billy@dangerous.fish
-
-
- re: Treegrids are awesome
- Cool, we've been needing an example and documentation
- doris@rufflazydogs.sleep
-
-
- re: Treegrids are awesome
- I hear the Fancytree library is going to align with this example!
- someone@please-do-it.company
-
-
- re: Treegrids are awesome
- Sometimes they are more like trees, others are more like grids
- mari@beingpractical.com
-
-
- re: Treegrids are awesome
- Cool, when it's a tree, let's keep left/right to collapse/expand
- issie@imadeadcatsadly.wascute
-
-
-
- re: Treegrids are awesome
- I see, sometimes right arrow moves by column
- kitten@kittenseason.future
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
-
- Right Arrow
-
-
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
-
-
- Down Arrow
-
-
-
-
-
-
-
-
- Up Arrow
-
-
-
-
-
-
-
-
- Tab
-
-
-
-
-
-
-
-
- Shift + Tab
-
-
-
-
-
-
-
-
- Home
-
-
-
-
-
-
-
-
- End
-
-
-
-
-
-
-
-
- Control + Home
-
-
-
-
-
-
-
-
- Control + End
-
-
-
-
-
-
-
-
-
- Enter
-
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- treegrid
-
- table
Identifies the element as a
- treegrid
.
-
-
-
-
- aria-label="Inbox"
- table
Provides an accessible name for the
- treegrid
.
-
-
- row
-
- tr
-
-
-
- row
.row
role is not an implicit semantic for the tr
element when in a treegrid
.
-
-
-
- tabindex="-1"
- tr
or td
-
-
-
- row
and gridcell
elements are focusable, but only one is included in the tab sequence.
-
-
-
- tabindex="0"
- tr
or td
-
-
-
- row
or gridcell
in the treegrid
has tabindex="0"
.row
in the treegrid
is included in the tab sequence when the page loads.treegrid
, the element included in the tab sequence changes to the element with focus as described in the section on
- roving tabindex.
-
-
-
-
-
- aria-expanded="false"
- tr
or td
-
-
-
- aria-expanded
is on the tr
elements, but when the treegrid is configured to support focus on cells only, aria-expanded
is on the first td
element contained in each row.
-
-
-
-
- aria-expanded="true"
- tr
or td
-
-
-
- aria-expanded
is on the tr
elements, but when the treegrid is configured to support focus on cells only, aria-expanded
is on the first td
element contained in each row.
-
-
-
-
- aria-level="number"
- tr
-
-
-
-
-
-
-
-
- aria-setsize="number"
- tr
- Defines the number of rows in the set of rows that are in the same branch and at the same level within the hierarchy.
-
-
-
-
-
-
- aria-posinset="number"
- tr
-
-
-
-
-
-
-
- gridcell
-
- td
-
-
-
- gridcell
.gridcell
role is not an implicit semantic for the td
element when in a treegrid
.aria-posinset
and aria-setsize
properties are not supported on row elements.
- This is being corrected in ARIA 1.2.
- Consequently, when validating the HTML in this example, errors are generated.
- Javascript and CSS Source Code
-
-
-
- HTML Source Code
-
-
-
-
-
- File Directory Treeview Example Using Declared Properties
- My Documents
tree, each parent node represents a folder and each end node represents a file.
- Activating a node selects the node and puts the name of the folder or file in the read-only edit field that represents the file viewer.
- aria-setsize
, aria-posinset
and aria-level
, which overrides browser computation of values for these properties.
- The ARIA specification for these properties states that browsers can, but are not required to, compute these values.
- Example
- My Documents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Accessibility Features
- Terms Used to Describe Trees
- Keyboard Support
-
-
-
-
-
-
-
- Key
- Function
-
-
- Enter
- Performs the default action, which is to select the node, causing the name of the node to appear in the
- File or Folder Selected
textbox.
-
- Space
- Performs the default action, which is to select the node, causing the name of the node to appear in the
- File or Folder Selected
textbox.
-
- Down arrow
-
-
-
-
-
-
- Up arrow
-
-
-
-
-
-
- Right Arrow
-
-
-
-
-
-
- Left Arrow
-
-
-
-
-
-
- Home
- Moves focus to first node without opening or closing a node.
-
-
- End
- Moves focus to the last node that can be focused without expanding any nodes that are closed.
-
-
- a-z, A-Z
-
-
-
-
-
-
-
-
- * (asterisk)
-
-
-
-
-
- Role, Property, State, and Tabindex Attributes
-
-
-
-
-
-
-
- Role
- Attribute
- Element
- Usage
-
-
-
- tree
-
- ul
-
-
-
- ul
element as a tree
widget.tree
container does not need a tabindex
attribute.
-
-
-
-
- aria-labelledby="ID_REFERENCE"
- ul
Refers to the heading element that contains the label that identifies the purpose of the
- tree
.
-
-
- treeitem
-
- li
Identifies the element as a
- treeitem
.
-
-
-
- tabindex="-1"
- li
-
-
-
- treeitem
element focusable without including it in the tab sequence of the page.treeitem
elements are focusable, but only one is included in the tab sequence.
-
-
-
- tabindex="0"
- li
-
-
-
- treeitem
element in the tab sequence.treeitem
in the tree
has tabindex="0"
.treeitem
in the tree
is included in the tab sequence when the page loads.tree
, the element included in the tab sequence changes to the element with focus as described in the section on
- roving tabindex.
-
-
-
-
- aria-expanded="false"
- li
-
-
-
- treeitem
elements that are parent nodes, i.e., they contain a ul
with the group
role.
-
-
-
- aria-expanded="true"
- li
-
-
-
- treeitem
elements that are parent nodes, i.e., they contain a ul
with the group
role.
-
-
-
- aria-selected="false"
- li
-
-
-
- treeitem
elements.
-
-
-
- aria-selected="true"
- li
-
-
-
- treeitem
elements.
-
-
-
- aria-setsize="number"
- li
Defines the number of
- treeitem
elements in the set of treeitem
elements that are in the same branch and at the same level within the hierarchy.
-
-
-
- aria-posinset="number"
- li
-
-
-
- treeitem
elements that are in the same branch and at the same level within the hierarchy.
-
-
-
- aria-level="number"
- li
-
-
-
- treeitem
in the hierarchical tree structure.treeitem
elements have aria-level="1"
.
-
-
-
- group
-
- ul
-
-
-
- ul
element as a container of treeitem
elements that form a branch of the tree.treeitem
.aria-level
, aria-setsize
and aria-posinset
values for the nodes contained in the branch if those properties are not specified explicitly in the code.Javascript and CSS Source Code
-
-
- HTML Source Code
-
-
-
-
- ARIA Authoring Practices Guide (APG) Home
-
-
APG Resources
-
-
- Design Patterns and Examples
-
-
Use ARIA Landmarks
-
-
Providing Accessible Names and Descriptions
-
-
And So Much More...
-
-
Current Work
-
-
- Release Plans
- Patterns Progress Status
- How to Write Regression Tests
- Meetings
- Get Involved
-
-
- Join the Task Force
-
-
Contribute via GitHub
-
-
Mailing Lists
-
-
ARIA Roles, Properties and States Referenced in Guidance and Examples
-
- h2
-h6
) or through the use of
- data-aria-roles
or data-aria-props
attributes on any heading within the practices. The data-aria-roles
or data-aria-props
attributes should contain a space separated list of values. The use of the data attribute overrides the identification of roles, properties or states from the text content of a heading. The suffix "(D)" indicates a reference came from a data attribute, otherwise the reference came from the text content of a heading.
-
-
+ Coverage and Quality Reports
+ About These Reports
+
+
+
+
+ h2
-h6
) within the content of a pattern or practice.data-aria-roles
or data-aria-props
attribute specified on a heading within a pattern or practice.
+ These data attributes may contain a space separated list of values.
+
+
+ CSV Files of Role, Properties and States Coverage
+ CSV Formatted Reports of Role, Property, and State Coverage
Example Coding Practices
+ Code Quality
Coding Summary
@@ -225,9 +250,6 @@
-
Index of ARIA Design Pattern Examples
+ Index
+ About the Index