Web Accessibility For Developers
Web Accessibility For Developers
TORONTO
Web Accessibility for Developers by Ryerson University, The Chang School is licensed
under a Creative Commons Attribution 4.0 International License, except where otherwise
noted.
Introduction
Getting the Most Out of This Book
Who Should Read This Book
Accessibility Statement
Background
1. Introduction
2. Introduction to WAI-ARIA
3. Basic WAI-ARIA
Book Recap
Answer Key: Self-Tests
Introduction
Learning Outcomes
Suggested Technology
You will need the following applications to complete the activities
in this book:
Suggested Readings
Suggested Reading:
Disclaimer
Toolkit
Try This
Suggested Reading
Activity Elements
Self-Tests
Try This: Skip ahead to the end of the book and read
through the Book Recap for a high-level summary of the
topics covered in the book.
Who Should Read This Book
Suggested Reading:
Key Point: Those who have taken our other courses will
have encountered this content already. Read again or skim
for a refresher.
© Jared Smith. Released under the terms of a Standard YouTube License. All rights
reserved.
rights reserved.
People who are blind tend to face many barriers in web content,
given the visual nature of the Web. They will often use a screen
reader to access their computer or device and may use a
refreshable Braille display to convert text to Braille.
Common barriers for this group include:
Visual content that has no text alternative
Functional elements that cannot be controlled with a
keyboard
Overly complex or excessive amounts of content
Inability to navigate within a page of content
Content that is not structured
Inconsistent navigation
Time limits (insufficient time to complete tasks)
Unexpected actions (e.g., redirect when an element receives
focus)
Multimedia without audio description
© rscnescotland. Released under the terms of a Standard YouTube License. All rights
reserved.
People with low vision are often able to see web content if it is
magnified. They may use a screen magnification program to
increase the size and contrast of the content to make it more
visible. They are less likely to use a screen reader than a person
who is blind, though, in some cases they will. People with low
vision may rely on the magnification or text customization
features in their web browser, or they may install other
magnification or text reading software.
Common barriers for this group include:
© Centre for Inclusive Design. Released under the terms of a Standard YouTube
For most people who are deaf the greatest barrier on the Web is
audio content that is presented without text-based alternatives.
They encounter relatively few barriers on the Web otherwise.
Those who are deaf and blind will face many more barriers,
including those described for people who are blind. For those
who communicate with American Sign Language (ASL) or other
sign languages, such as langue de Signes Quebecoise (LSQ), the
written language of a website may produce barriers similar to
those faced when reading in a second language.
Common barriers for this group include:
Everyone
Key Point: Those who have taken our other courses, or read
our other books, will have read through this content
already. Read again or skim for a refresher.
Curb Cuts
Suggested Reading:
AODA Background
A YouTube element has been excluded from this version of the text. You can
For those reading this book from Ontario, Canada, we’ll provide
occasional references to the Accessibility for Ontarians with
Disabilities Act (AODA). For those reading this book from outside
Ontario, you might compare AODA’s web accessibility
requirements with those in your local area. They will be similar in
many cases and likely based on the W3C WCAG 2.0 Guidelines.
The goal in Ontario is for all obligated organizations to meet the
Level AA accessibility requirements of WCAG 2.0 by 2021, which,
ultimately, is the goal of most international jurisdictions.
The AODA provided the motivation to create this book. All
businesses and organizations in Ontario with more than 50
employees (and all public sector organizations) are now required
by law to make their websites accessible to people with
disabilities (currently at WCAG 2.0 Level A). Many businesses still
don’t know what needs to be done in order to comply with the
new rules. This book hopes to fill some of that need.
The AODA has its roots in the Ontario Human Rights Code,
introduced in 1990. It essentially made it illegal to discriminate
based on disability (among other forms of discrimination). The
development of the AODA began in earnest in 1994 with the
emergence of the Ontarians with Disabilities Act (ODA). Its aim
was to legislate the removal and prevention of barriers that
inhibit people with disabilities from participating as full members
of society, improving access to employment, goods and services,
and facilities. The act was secured as law in 2001.
With the election of a new government in 2003, the movement
that brought us the ODA sought to strengthen the legislation.
The Accessibility Standards Advisory Council was established and
the AODA was passed as law in 2005, and, in July 2011, the
Integrated Accessibility Standards Regulation (IASR) brought
together the five standards of the AODA covering Information
and Communication, Employment, Transportation, and Design of
Public Spaces, in addition to the original Customer Service
standard.
The AODA sets out to make Ontario fully accessible by 2025,
with an incremental roll-out of accessibility requirements over a
period of 20 years. These requirements span a whole range of
accessibility considerations — from physical spaces to customer
service, the Web, and much more.
Our focus here is on access to the Web. The timeline set out in
the AODA requires government and large organizations to
remove all barriers in web content between 2012 and 2021. The
timeline for these requirements is outlined in the table below.
Any new or significantly updated information posted to the Web
must comply with the given level of accessibility by the given
date. This includes both Internet and Intranet sites. Any content
developed prior to January 1, 2012, is exempt.
Level A Level AA
January 1, 2016
(except live
(including live
description)
organization as outlined in the Public Service of Ontario Act 2006 Reg. 146/10, or
For more about the AODA you can review the following
references:
Suggested Reading:
History of the Ontarians with Disabilities Act.(ODA)
(David Lepofsky)
Integrated Accessibility Standards Regulation
Reg. 146/10: Public Bodies and Commission Public
Bodies – Definitions
About WCAG and WAI-ARIA
Before we get into the main part of the book, some background
information on the relevant W3C specifications will help provide
some context for why developers should learn to use WAI-ARIA
when they are developing custom interactivity for the Web.
WCAG
Suggested Reading:
Suggested Reading:
Understanding WCAG 2.0 (see Success Criteria and
Techniques)
How to Meet WCAG 2
WAI-ARIA
Suggested Reading:
Objectives
Activities
Note: If you are using this book as part of this course, please read
on. Otherwise, submitting coding assignments is not required.
For Linux users you can use your system’s package manager to
install Git for command line use. On Ubuntu for instance, at the
command prompt you can run apt-get as the root user to install
Git:
#> sudo apt-get install git
1. Logged into GitHub, find your way to the book files, and
fork that repository. The fork button is at the top right of
the GitHub screen while viewing a repository. This
creates a copy of the repository under your own GitHub
account where you will work from.
2. After you have forked the book files, go into the settings
for that repository and change the name from
learnaria.github.io to [username].github.io, where
username is your GitHub account username. This will
automatically create your GitHub Pages website at
https://[username].github.io.
3. Now you will want to create a clone of your forked book
files repository on your computer, through which you
will do your work. From the command line issue the
following command to create a clone of the forked
version of the book files you created, where [username]
is your GitHub account username. You can also copy the
https link from a field that opens when you click on the
“Clone or download” button in your repo.#>git clone
https://github.com/[username]/[username].github.io.git
4. If you are using SourceTree, click on “+ New Repository”
and choose “Clone from URL” and enter the above URL
into the “Source URL” field. Set the “Destination Path” to
your preferred work directory.
You should now have a copy of the book files available locally
that you can edit and commit back as your assignment updates,
which become part of your GitHub Pages website.
Note that it can take a few seconds or a minute for changes
committed to your GitHub Pages repository to actually show up
on the website.
If You Already Have a GitHub Pages Site
You do not need to be an expert Git user, but you should know a
few basic commands if you are working from a command prompt.
The commands you’ll likely use are the following
https://pressbooks.library.ryerson.ca/wafd/?p=172
1.3 Activity 1: How to Submit Assignments
If you are taking a course that uses this textbook, your instructor
will provide information on how and where to submit the URLs to
your various assignment submissions.
Grading Rubric
Criteria Points
URL submitted to your copy of all the course files either in GitHub Pages 10.0 pts
Disclaimer
Toolkit:
Toolkit: Visit the Chrome store while using the Chrome web
browser to install the ChromeVox screen reader. It will be a
key element of your Toolkit.
A YouTube element has been excluded from this version of the text. You can
Toggle
To turn ChromeVox on or off without having to go into
ChromeVox Cvox+A+A
the ChromeVox Settings
On/Off
Stop
Stop ChromeVox from reading Ctrl
Reading
screen.
focus, and note any elements that are clickable but not
Tab Tab, Shift +
focusable with the keyboard.
Navigation Tab
other elements that are not visible but are read aloud by
ChromeVox.
Step through all the headings on a page. Note whether all Cvox+L+H
Navigate
headings are announced as expected. Note the heading then
through
level announced. Are they sequenced to create semantic Up/Down
Headings
structure (i.e., nested in the proper order)? Arrows
Cvox+L+;
through page. Are all areas of the page contained in a landmarked colon) then
Arrows
Cvox+L+L
List the links and navigate through them using the Arrow
then
List Links keys, listen for meaningfulness, or listen for context
Up/Down
when links are otherwise meaningless.
Arrows
Cvox+L+F
Navigate Navigate to forms on a page, then press the Tab or F keys
then
through to listen to each of the fields. Are fields announced
Up/Down
Forms effectively, including required fields?
Arrows
Cvox+L+T
then
Up/Down
Arrows
Navigate to Tables on a page, press Enter to go to a table,
then Enter
press Up/Down Arrow keys to move through cells in
to select
Navigate sequence (left to right, top to bottom), press
Table
through Ctrl+Alt+Arrow to move to adjacent cells, press Ctrl+Alt
and 5 on the number pad to list column and row headers Cvox+Arrow
Tables
to move
where applicable. Note whether header cells are read or
within table
not. Are Fieldset labels announced, where applicable?
Cvox+TH
to
announce
headers
1.7 Activity 2: Set Up and Use ChromeVox
Key Point:
Requirements
Grading Rubric
Criteria Points
https://pressbooks.library.ryerson.ca/wafd/?p=205
2. INTRODUCTION TO WAI-ARIA
2.1 Objectives and Activities
Objectives
Activities
for user interaction, how they relate to each other, and their current state.”
Source: W3C
Source: W3C
and attributes, and reliably represent the object in a way that various
https://pressbooks.library.ryerson.ca/wafd/?p=259
2.3 Roles, States, and Properties
Roles
and support interaction with the object in a manner that is consistent with
Source: W3C
https://pressbooks.library.ryerson.ca/wafd/?p=267
States
W3C definition of states
not affect the essential nature of the object, but represent data associated
versus properties.”
Source: W3C
aria-busy
aria-checked
aria-expanded
aria-disabled
aria-hidden
Properties
W3C definition of properties
properties (for example, aria-multiline) are less likely to change than states,
but note that the frequency of change difference is not a rule. A few
Source: W3C
aria-describedby
aria-atomic
aria-autocomplete
aria-colcount
aria-colspan
aria-controls
Suggested Reading: See the WAI-ARIA Specification for a
full list of states and properties.
2.4 Static vs. Dynamic WAI-ARIA
Even if you don’t use JavaScript, there is a good amount you can
do with static WAI-ARIA to improve the accessibility of a website
or web application. You may have already gathered from the
discussion of states and properties that some WAI-ARIA can be
written right into the HTML of a web page (e.g., properties and
landmarks). Others need to be dynamically updated based on
user input or context (e.g., states and some properties).
Some of the static WAI-ARIA attributes you are likely to use are
listed below, with their descriptions from W3C.
https://pressbooks.library.ryerson.ca/wafd/?p=272
Here’s a video that shows how ChromeVox would read out the
menu described above:
Video: Example Menu with WAI-ARIA (0:33)
A YouTube element has been excluded from this version of the text. You can
Toolkit: For a full list of roles, see section 1 in the The ARIA
Role Matrices.
2.5 Browser and Screen Reader Support for
WAI-ARIA
Toolkit:
Definitions
https://pressbooks.library.ryerson.ca/wafd/?p=275
2.7 Validating WAI-ARIA
A YouTube element has been excluded from this version of the text. You can
Web-Based Validator
Chrome
Firefox
Requirements
For full marks on this activity, list at least five static and five
dynamic WAI-ARIA enabled elements in your answer. Include a
brief description for each. Here’s a few made-up examples of
what you might report in your findings:
Note: Not all ARIA-related markup starts with the “aria-” prefix.
Scan through the WAI-ARIA documentation introduced in this
unit for a listing of all potential WAI-ARIA markup you might
come across. Also, not all accessibility enhancements are WAI-
ARIA. For example, alt is an accessibility feature of the HTML
img element. You can mention these other accessibility features;
however, they will not count toward your mark on this activity.
Grading Rubric
Criteria Points
At least five instances of static WAI-ARIA being used in the page are listed. 5.0 pts
At least five instances of dynamic WAI-ARIA being used in the page are
5.0 pts
listed.
https://pressbooks.library.ryerson.ca/wafd/?p=289
3. BASIC WAI-ARIA
3.1 Objectives and Activities
Objectives
Activities
banner
complementary
contentinfo
form
main
navigation
region
search
A YouTube element has been excluded from this version of the text. You can
https://pressbooks.library.ryerson.ca/wafd/?p=303
Suggested Reading:
aria-describedby
aria-labelledby
aria-label
aria-required
aria-controls
aria-details
aria-haspopup
aria-live
aria-owns
aria-relevant
aria-roledescription
3.4 WAI-ARIA Alert and Message Dialogs
https://pressbooks.library.ryerson.ca/wafd/?p=308
https://pressbooks.library.ryerson.ca/wafd/?p=308
A YouTube element has been excluded from this version of the text. You can
Dialogs
Dialogs are used like modal dialogs are, except it is still possible
to interact with the other content of the page. These are defined
using role="dialog" .
Suggested Reading:
https://pressbooks.library.ryerson.ca/wafd/?p=310
3.6 Keyboard Interaction
https://pressbooks.library.ryerson.ca/wafd/?p=312
https://pressbooks.library.ryerson.ca/wafd/?p=312
Combobox
Grid
Listbox
Menu or menu bar
Radiogroup
Tabs
Toolbar
Tree View
3.7 Application and Presentation Roles
Application Role
Presentation Role
https://pressbooks.library.ryerson.ca/wafd/?p=314
ChromeVox (53.0.2784.5)
Suggested Reading:
role=”log”
role=”marquee”
role=”timer”
role=”status”
https://pressbooks.library.ryerson.ca/wafd/?p=317
Requirements
Part 1: Landmarks
Grading Rubric
Criteria Points
Content Contained:
2.0 pts
All content is contained within a landmarked region.
Correct Landmarks:
3.0 pts
Appropriate landmarks have been used for each region.
Messages Announced:
submitted with and without invalid input. When the first required field is 4.0 pts
Landmarks Distinguishable:
1.0 pts
Landmark regions with the same role are distinguishable from each other.
https://pressbooks.library.ryerson.ca/wafd/?p=321
4. INTERACTIVE WAI-ARIA (BASIC)
4.1 Objectives and Activities
Objectives
Activities
Suggestion box
Tooltips
Progress bar
4.2 Toggle Buttons (Activity Example)
role="button"
tabindex="0"
aria-label="[button name]"
aria-pressed="[true|false]"
Activity Element: Where available, a Suggested Reading is
included that provides additional information about
accessibility features for the widget being discussed, often
linking to the W3C WAI-ARIA 1.1 Authoring Practice
documentation, or to a similar resource. These readings are
optional but recommended.
https://pressbooks.library.ryerson.ca/wafd/?p=324
https://pressbooks.library.ryerson.ca/wafd/?p=324
https://pressbooks.library.ryerson.ca/wafd/?p=324
https://pressbooks.library.ryerson.ca/wafd/?p=324
the dialog were confirming the action of deleting the page from
context.
action.
higher in the list, pressing Alt + U when the focus is in the list
https://pressbooks.library.ryerson.ca/wafd/?p=324
Accessible Toggle Buttons in Action
The buttons are accessed initially with the Tab key, and the Tab
key is used to move between buttons. The Space bar or Enter
keys are used to activate and deactivate buttons. Aim to have the
widget you edit in the associated activity function like that
presented in the video (there is no associated activity for this
example).
Video: Accessible Toggle Buttons
A YouTube element has been excluded from this version of the text. You can
role=’region’
aria-live=’polite’
https://pressbooks.library.ryerson.ca/wafd/?p=330
https://pressbooks.library.ryerson.ca/wafd/?p=330
https://pressbooks.library.ryerson.ca/wafd/?p=330
https://pressbooks.library.ryerson.ca/wafd/?p=330
https://pressbooks.library.ryerson.ca/wafd/?p=330
Adding Keyboard Operability
Down Arrow: If the popup is available, moves focus into the popup:
popup.
textbox.
accepts the suggestion either by placing the input cursor at the end of
the accepted value in the textbox or by performing a default action on
then clear the textbox so the user can add another recipient.
Standard single line text editing keys appropriate for the device
Note: Standard single line text editing keys appropriate for the
device platform:
manipulation.
attribute.
4. IMPORTANT: Be sure that JavaScript does not interfere with
https://pressbooks.library.ryerson.ca/wafd/?p=330
A YouTube element has been excluded from this version of the text. You can
/suggest.html
/assets/ik_suggest.js
Requirements
Grading Rubric
Criteria Points
Initial Instructions:
2.0 pts
Instructions are provided when the country field receives focus.
Suggestion Instructions
1.0 pts
Instructions are provided when suggestions are available.
Keyboard Access:
5.0 pts
A country selection can be made using only the keyboard
role="tooltip"
aria-hidden:[true|false]
aria-live="polite"
tabindex = [0|-1]
https://pressbooks.library.ryerson.ca/wafd/?p=336
The first thing to add to the init() function, where the tooltip
<span> element is defined, are the WAI-ARIA attributes. First,
define the tooltip with role="tooltip" . Hide the tooltip by
default with aria-hidden="true" . Also, add a live region with
aria-live="polite" , so screen readers automatically read the
tooltip when it appears. Note, the WAI-ARIA 1.1 best practices
recommend using aria-describedby within the owning element
to reference the content of a tooltip, which does not announce as
expected with current versions of Chrome. Instead, we use aria-
live , which announces correctly across all current browsers.
https://pressbooks.library.ryerson.ca/wafd/?p=336
https://pressbooks.library.ryerson.ca/wafd/?p=336
https://pressbooks.library.ryerson.ca/wafd/?p=336
https://pressbooks.library.ryerson.ca/wafd/?p=336
Note:
displayed.
mouseOut.
https://pressbooks.library.ryerson.ca/wafd/?p=336
https://pressbooks.library.ryerson.ca/wafd/?p=336
Accessible Tooltip in Action
A YouTube element has been excluded from this version of the text. You can
Accessible Tooltips
/tooltip.html
/assets/ik_tooltip.js
Requirements
When you have applied your changes and tested to be sure your
tooltips function as described, submit the URL to your
tooltip.html file on your GitHub Pages site, to the file on the web
server you are using to host your copy of the book files, or to a
Githack URL.
Grading Rubric
Criteria Points
Tooltips Open:
Tooltips open when their owning element receives keyboard focus or 3.0 pts
mouseover.
Tooltips Read:
Tooltips read aloud when their owning element receives keyboard focus or 3.0 pts
mouseover.
Tooltips Hides:
2.0 pts
Tooltips hide when focus is removed or on mouseout.
Tooltips Escape:
2.0 pts
Tooltips hide when the Esc key is pressed.
role="progressbar"
tabindex = [0|-1]
aria-valuenow = "0"
aria-valuemin = "0"
role = "region"
aria-live = "assertive"
aria-atomic = "additions"
aria-hidden = "[true|false]"
Suggested Reading: For more about accessible progress
bars, see WAI-ARIA 1.1: Progressbar
https://pressbooks.library.ryerson.ca/wafd/?p=341
https://pressbooks.library.ryerson.ca/wafd/?p=341
https://pressbooks.library.ryerson.ca/wafd/?p=341
https://pressbooks.library.ryerson.ca/wafd/?p=341
https://pressbooks.library.ryerson.ca/wafd/?p=341
https://pressbooks.library.ryerson.ca/wafd/?p=341
Based on the Progress Bar details on the previous page, apply what you have learned to
the associated book files to make the progress bar there accessible.
Files for this activity include:
/progressbar.html
/assets/ik_progressbar.js
Use the surroundings of the highlighted code on the previous page as a guide to find
where the fixes should be applied. Repair the accessibility of the progress bar by
applying the highlighted code to the /assets/ik_progressbar.js file.
Note: While we suggest using the highlighted code we’ve provided, you are free to
come up with your own solutions provided they produce the expected results listed in
the marking rubric below.
Test your updated progress bar with ChromeVox to ensure each element described
in the marking rubric below is functioning as suggested.
Requirements
When you have applied your changes and tested to be sure your progress bar
functions as described, submit the URL to your progressbar.html file on your GitHub
Pages site, to the file on the web server you are using to host your copy of the course
files, or to a GitHack URL.
Grading Rubric
Criteria Points
Instructions Provided:
When the progress bar begins running, instructions are provided on how to announce progress 2.0 pts
percentage.
Announce Complete:
3.0 pts
When progress finishes, Loading Complete is announced.
Objectives
Activities
Slider
Accordion
Tab panel
Carousel
5.2 Sliders
tabindex="[0 | -1]"
role="slider"
aria-valuemin="[number]"
aria-valuemax="[number]"
aria-valuenow="[number]"
https://pressbooks.library.ryerson.ca/wafd/?p=349
https://pressbooks.library.ryerson.ca/wafd/?p=349
https://pressbooks.library.ryerson.ca/wafd/?p=349
https://pressbooks.library.ryerson.ca/wafd/?p=349
https://pressbooks.library.ryerson.ca/wafd/?p=349
https://pressbooks.library.ryerson.ca/wafd/?p=349
Adding Keyboard Operability
Home: Set the slider to the first allowed value in its range.
End: Set the slider to the last allowed value in its range.
Note:
1. Focus is placed on the slider (the visual object that the mouse
https://pressbooks.library.ryerson.ca/wafd/?p=349
A YouTube element has been excluded from this version of the text. You can
Accessible Slider
Based on the Slider details on the previous page, apply what you
have learned to the associated book files to make the slider there
accessible.
Files for this activity include:
/slider.html
/assets/ik_slider.js
Requirements
When you have applied your changes and tested to be sure your
slider functions as described, submit the URL to your slider.html file
on your GitHub Pages site, to the file on the web server you are
using to host your copy of the course files, or to a GitHack URL.
Grading Rubric
Criteria Points
Slider Focusable:
2.0 pts
Slider thumb is keyboard focusable.
Keyboard Operable:
Slider thumb moves using Left and Right Arrow keys, and the Home and End 5.0 pts
keys.
Value Announced:
2.0 pts
When the slider moves, its new value is announced.
role="heading"
role="button"
aria-controls="[panel id]"
tabindex="0"
role="region"
https://pressbooks.library.ryerson.ca/wafd/?p=353
https://pressbooks.library.ryerson.ca/wafd/?p=353
https://pressbooks.library.ryerson.ca/wafd/?p=353
https://pressbooks.library.ryerson.ca/wafd/?p=353
Add a <div> inside the header (i.e., DT ) and define its role as a
button. The button is given an aria-controls attribute to define
which of the accordion panels it controls. By default the toggle
state is set to false with aria-expanded="false" to be updated
dynamically when the button is clicked or key pressed. Finally
add tabindex="0" to the button ( <div> ) to make it keyboard
focusable.
https://pressbooks.library.ryerson.ca/wafd/?p=353
The tabindex will make the button focusable, but it will not
make it clickable. The .on() jQuery function adds a click event to
the button, but a keypress event must also be added. Adding
.on('keydown') activates the onKeyDown function, defined below,
so the accordion headers operate with both a mouse click and a
keypress.
https://pressbooks.library.ryerson.ca/wafd/?p=353
https://pressbooks.library.ryerson.ca/wafd/?p=353
https://pressbooks.library.ryerson.ca/wafd/?p=353
https://pressbooks.library.ryerson.ca/wafd/?p=353
Enter or Space:
header.
header.
accordion header.
https://pressbooks.library.ryerson.ca/wafd/?p=353
Accessible Accordion
Based on the Accordion details on the previous page, apply what you
have learned to the associated book files to make the accordion there
accessible.
Files for this activity include:
/accordion.html
/assets/ik_accordion.js
Requirements
When you have applied your changes and tested to be sure your
accordion functions as described, submit the URL to your
accordion.html file on your GitHub Pages site, to the file on the web
server you are using to host your copy of the book files, or a GitHack
URL.
Grading Rubric
Criteria Points
Header Focus:
1.0 pts
Accordion headers are keyboard focusable.
Headers as Buttons:
2.0 pts
Accordion headers are announced as buttons instead of list items.
Open Panels:
2.0 pts
Accordion headers open panels with a click or key press.
Expand/Collapse:
Accordions announce expanded when a panel is opened and collapsed when 2.0 pts
closed.
Panels Focusable:
2.0 pts
Accordion panels are focusable with a Tab key press when opened.
Header Navigation:
Navigation between accordion headers with Up and Down Arrow keys, and the 1.0 pts
Tab key.
role="tablist"
role="tabpanel"
role="tab"
aria-hidden="[true|false]"
tabindex = [0 | -1]
aria-controls="[panel id]"
aria-selected="[true|false]"
https://pressbooks.library.ryerson.ca/wafd/?p=357
In our case, we are generating the tabs for each child <div>
defined in the HTML, though tabs and tab panels could be static
HTML. The tablist is made up of a <ul> and child <li> elements.
We assign role="tablist" to the <ul> to remove its list
semantics and replace it with tab panel semantics.
https://pressbooks.library.ryerson.ca/wafd/?p=357
https://pressbooks.library.ryerson.ca/wafd/?p=357
The tabs themselves are now defined, replacing the list item
semantics with tab semantics adding role="tab" to each of the
<li> elements generated. We also need to define which tab
controls which tabpanel, dynamically generating aria-controls="
[panel_id]" for each of the tabs.
https://pressbooks.library.ryerson.ca/wafd/?p=357
https://pressbooks.library.ryerson.ca/wafd/?p=357
https://pressbooks.library.ryerson.ca/wafd/?p=357
https://pressbooks.library.ryerson.ca/wafd/?p=357
Adding Keyboard Operability
Tab: When focus moves into the tab list, places focus on the active
tab element. When the tab list contains the focus, moves focus to
the next element in the page tab sequence outside the tablist, which is
typically either the first focusable element inside the tab panel or the
first tab, moves focus to the last tab. Optionally, activates the
Right Arrow: Moves focus to the next tab. If focus is on the last
orientation:
Space or Enter: Activates the tab if it was not activated
automatically on focus.
the menu.
current tab element and its associated tab panel. If any tabs
remain, sets focus to the tab following the tab that was closed
Note:
Focus.
above.
https://pressbooks.library.ryerson.ca/wafd/?p=357
https://pressbooks.library.ryerson.ca/wafd/?p=357
Based on the Tab Panel details on the previous page, apply what
you have learned to the associated book files to make the tab
panel there accessible.
Files for this activity include:
/tabs.html
/assets/ik_tabs.js
Requirements
When you have applied your changes and tested to ensure your
tab panel functions as described, submit the URL to your
tabs.html file on your GitHub Pages site, to the file on the web
server you are using to host your copy of the book files, or
a GitHack URL.
Grading Rubric
Criteria Points
Tab Position:
1.0 pts
Focus position in the tablist is announced.
Tab key can be used to move from a selected tab directly to its associated 2.0 pts
Panels Focusable:
2.0 pts
Panels are keyboard focusable.
role="region"
aria-live="polite"
tabindex="0"
aria-hidden="(true|false)"
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
Hide images from screen readers. Notice that the alt text for
the images are defined in the HTML but left empty so it is not
read in this case. Screen readers will read the figcaptions .
https://pressbooks.library.ryerson.ca/wafd/?p=362
Add screen reader instructions by generating a <div> that
contains the instruction text defined earlier and hide the <div>
by default. The instructions are read when the carousel receives
focus, and the aria-describedby attribute is dynamically added to
reference the instructions.
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
https://pressbooks.library.ryerson.ca/wafd/?p=362
Accessible Carousel
/carousel.html
/assets/ik_carousel.js
Use the surroundings of the highlighted code on the previous page as a guide
to find where the fixes should be applied. Repair the accessibility of the
carousel by applying the highlighted code to the /assets/ik_carousel.js file.
Note: While we suggest using the highlighted code we’ve provided, you are
free to come up with your own solutions provided they produce the expected
results listed in the marking rubric below.
Test your updated carousel with ChromeVox to ensure each element
described in the marking rubric below is functioning as suggested.
Requirements
When you have applied your changes and tested to ensure your carousel
functions as described, submit the URL to your carousel.html file on your
GitHub Pages site, to the file on the web server you are using to host your copy
of the book files, or a GitHack URL.
Grading Rubric
Criteria Points
Instructions Provided
1.0 pts
Screen reader instructions are provided when carousel receives focus.
Carousel Focusable
1.0 pts
Carousel panels are keyboard focusable.
Carousel Navigation
3.0 pts
Navigate between panels with the Left and Right Arrow keys.
When in focus, or while a mouse pointer is hovering over the carousel, panels rotate 2.0 pts
manually only.
Objectives
Activities
Menu bar
Tree menu
Sortable list
6.2 Menu Bars
aria-hidden = [true|false]
role = "menubar"
role = "menu"
role = "menuitem"
tabindex = [0 | -1]
aria-haspopup = "true"
aria-expanded = "[true|false]"
aria-selected = "[true|false]"
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
For all the menu items in the menu bar that have submenus,
add role="menu" to their <ul> and hide them by default using
aria-hidden="true" . This can be located after the
$elem.find('ul:eq(0)') block presented immediately above.
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
For each of the menu items that has a submenu, add aria-
haspopup="true" to announce the presence of the submenu, and
set its default state to “collapsed” by adding aria-
expanded="false" .
https://pressbooks.library.ryerson.ca/wafd/?p=368
When a menu item is marked selected, also add aria-
selected="true" and add keyboard access back to the menu item
with tabindex="0" .
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
https://pressbooks.library.ryerson.ca/wafd/?p=368
When reading the following descriptions, also keep in mind these items:
1. Focusable elements, which may have role menuitem ,
items.
menu .
4. Except where noted, menus opened from a menu button behave the
keyboard focus is placed on the first item. All items are focusable as
Enter:
Space:
submenu, opens the submenu and places focus on its first item.
(Optional): When focus is on a menuitem that does not have
Down Arrow:
Up Arrow:
opens its submenu and places focus on the last item in the
submenu.
Right Arrow:
submenu, opens the submenu and places focus on its first item.
Note that if the menubar were not present, e.g., the menus
submenu.
Left Arrow:
menubar .
End: If arrow key wrapping is not supported, moves focus to the last
focus to the next menu item in the current menu whose label begins
Escape: Close the menu that contains focus and return focus to the
Tab: Moves focus to the next element in the tab sequence, and if the
item that had focus is not in a menubar , closes its menu and all
sequence, and if the item that had focus is not in a menubar , closes
Note:
context. For example, a rich text editor may have a menu bar
same menuitem .
https://pressbooks.library.ryerson.ca/wafd/?p=368
Accessible Menu Bar in Action
/menu.html
/assets/ik_menu.js
Requirements
When you have applied your changes and tested to be sure your
menu bar functions as described, submit the URL to your
menu.html file on your GitHub Pages site, to the file on the web
server you are using to host your copy of the book files, or
a GitHack URL.
Grading Rubric
Criteria Points
Instructions Provided:
Instructions are announced on how to use the menu bar with a keyboard, 1.0 pts
Submenus Announced:
When a menu item with a submenu receives focus, the presence of a 2.0 pts
submenu is announced.
Focus Control:
2.0 pts
Only elements of the menu bar that are in view are able to receive focus.
Keyboard Operable:
As described in Adding Keyboard Operability for a menu bar, the menu 3.0 pts
tabindex = [0 | -1]
role = "tree"
role = "treeitem"
role = "presentation"
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
Within the init() function, for each tree item use the text of
the associated span element as its label. To ensure both the label
and the contents of the span element are not both read, assign
role="presentation" to the span .
An interactive or media element has been excluded from this version
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
https://pressbooks.library.ryerson.ca/wafd/?p=374
Right Arrow:
not move.
node.
Left Arrow:
Down Arrow: Moves focus to the next node that is focusable without
Home: Moves focus to the first node in the tree without opening or
closing a node.
End: Moves focus to the last node in the tree that is focusable
Enter: Activates a node, i.e., performs its default action. For parent
single-select trees where selection does not follow focus (see note
the next node with a name that starts with the string of
characters typed.
* (Optional): Expands all siblings that are at the same level as the
current node.
Selection in multi-select trees: Authors may implement either of
model that does not require the user to hold a modifier key, such as
Shift or Ctrl, while navigating the list or an alternative model that does
nodes.
the Shift or Ctrl modifier unselects all selected nodes except for
node.
nodes.
Note:
activedescendant.
the previously selected node and select the newly focused node.
accessibility.
vice versa.
For the tree menu created here, we’ve added in basic keyboard
operability. Keyboard operation includes: Up and Down, and Left
and Right Arrows for navigating within the tree, and the Enter or
Space bar keys to toggle submenus open or closed. The Tab key
by default enters and exits the tree menu and does not need to
be defined as part of the keyboard operability of the tree menu.
https://pressbooks.library.ryerson.ca/wafd/?p=374
Based on the Tree Menu details on the previous page, apply what
you have learned to the associated book files to make the tree
menu there accessible.
Files for this activity include:
/tree.html
/assets/ik_treemenu.js
Requirements
When you have applied your changes and tested to be sure your
tree menu functions as described, submit the URL to your
tree.html file on your GitHub Pages site, to the file on the web
server you are using to host your copy of the book files, or
a GitHack URL.
Grading Rubric
Criteria Points
Instructions Provided:
When the tree menu receives focus, instructions are announced on 1.0 pts
When navigating through the tree menu with a keyboard, elements are 2.0 pts
Tree Submenus:
When a tree menu item with a submenu receive focus, the submenu 2.0 pts
Focus Control:
Only elements of the tree menu that are in view are able to receive 2.0 pts
focus.
Keyboard Operable:
Tree menu functions with a keyboard as described in Adding Keyboard 3.0 pts
role = "list"
role = "listitem"
https://pressbooks.library.ryerson.ca/wafd/?p=379
https://pressbooks.library.ryerson.ca/wafd/?p=379
https://pressbooks.library.ryerson.ca/wafd/?p=379
https://pressbooks.library.ryerson.ca/wafd/?p=379
In the items section of the init() function, where draggable is
defined for each item in the list, add a redundant
role="listitem" , and generate a label for each item that
describes the list item’s current position and that that list item is
“movable.” Finally, set tabindex="0" on the first list item, and
tabindex="-1" on the other list items in order to ensure a list
item is focusable by default.
https://pressbooks.library.ryerson.ca/wafd/?p=379
Where the draggable attributes are defined near the end of the
init() function, attach a keydown reference to the onKeyDown()
function to make the list draggable with a keyboard.
https://pressbooks.library.ryerson.ca/wafd/?p=379
https://pressbooks.library.ryerson.ca/wafd/?p=379
https://pressbooks.library.ryerson.ca/wafd/?p=379
Sortable List in Action
A YouTube element has been excluded from this version of the text. You can
view it online here: https://pressbooks.library.ryerson.ca/wafd/?p=379
6.7 Activity 14: Accessible Sortable List
/sortable.html
/assets/ik_sortable.js
When you have applied your changes and tested to be sure your
sortable list functions as described, submit the URL to your
sortable.html file on your GitHub Pages site, to the file on the
web server you are using to host your copy of the book files, or
a GitHack URL.
Grading Rubric
Criteria Points
Instructions Provided:
Instructions are announced on using the sortable list with a keyboard 1.0 pts
When navigating through list items, their position is announced along with 2.0 pts
Using the keyboard operation described in Adding Keyboard Operability 3.0 pts
for sortable lists, list items can be moved without using a mouse.
Moved position:
4.0 pts
When a list items is moved, its new position is announced.
In Chapter 4 and the two chapters that follow, the focus moved
to practical implementation of WAI-ARIA, looking at specific
interactions and the types of information that need to be
available to assistive technologies to ensure these interactions
are accessible to users of these AT.
In this unit, we looked specifically at:
Join GitHub
SourceTree
GitHub Desktop
jQuery UI Accessibility Enhancements
Accessible MooTools Widgets
WAI-ARIA Authoring Practices 1.1
ARIA Techniques for WCAG 2.0
Using WAI-ARIA
ChromeVox Screen Reader
ChromeVox_Key_Commands (Word)
The ARIA Role Matrices
WAI-ARIA Screen Reader Compatibility
WAI-ARIA Browser Compatibility
ARIA Alert Support
User Agent Support Notes for ARIA Techniques
W3C HTML Validator
Chrome Developer Tools
Lighthouse
ARIA Validator
aXe (for Chrome)
aXe (for Firefox)
Combobox
Grid
Listbox
Menu or menu bar
Radiogroup
Tabs
Toolbar
Tree View
Answer Key: Self-Tests
Self-Test 1
Self-Test 2
Self-Test 3