The Web is for Everyone
An Introduction to Accessibility
Jon Kuperman
@jkup
Today we’ll be covering
Similar Fields
Web accessibility means that people with disabilities can use the Web.
More specifically, Web accessibility means that people with disabilities can perceive, understand, navigate, and interact with the Web, and that they can contribute to the Web.
Let’s Talk Numbers
About 56.7 million Americans — 19 percent of the population — had a disability in 2010
An estimated 7.9 million persons (age 6 and older) have difficulty seeing words and letters in ordinary newspaper print
Lighthouse International Research Study
Currently around 10 per cent of the total world's population, or roughly 650 million people, live with a disability.
The Web is
Already Accessible
even if your website is not
1991
Why
Developers
should care
WebAIM Checklist
All websites should be
Types of Disabilities
So Many Ways
To Browse The Web
Mouth Sticks
Screen Readers
Magnification
Keyboard shortcuts
Keyboard Only
Head Wand and Mouthstick
Single Switch
Screen Reader
Let’s talk about
Keyboards
Keyboard
shortcuts
Keyboard
navigation
Tabbable
Elements
Shift + Tab Tab
Tabindex
<div tabindex=“0”>I’m focusable</div>
Tabindex Values
Visible Focus
Skip links
Learn more about skip links
Setting up our project
github.com/jkup/learn-a11y
Exercise 1: Keyboard Navigation
github.com/jkup/learn-a11y
bit.ly/2ly0XOJ
Focus
Control
document.activeElement
var currentElement = document.activeElement;
Tabtrapping
Element.focus()
if (document.activeElement === firstTabStop) {
e.preventDefault();
lastTabStop.focus();
}
Exercise 2: Focus Control
github.com/jkup/learn-a11y
Screen Readers
Most Popular Desktop Screen Readers
<img alt=“Alternate Text” />
What your users hear
What your users hear
Writing Good Alt Text
http://webaim.org/techniques/alttext/
Interesting Alt text tips
Hiding things from screen readers
Hide from user but show to screen readers
.screenreader {
position: absolute;
left: -10000px;
width: 1px;
height: 1px;
overflow: hidden;
}
label
<label for="username">Click me</label>�<input type="text" id="username">
aria-labelledby
<div id="billing">Billing Address</div>��<div>� <div id="name">Name</div>� <input type="text" aria-labelledby="billing name"/>�</div>�<div>� <div id="address">Address</div>� <input type="text" aria-labelledby="billing address"/>�</div>
ARIA Roles
HTML5 elements vs ARIA roles
Sometimes it’s nice to have both for older browsers
<article role=“article”>Your Content</article>
HTML5 elements vs ARIA roles
Which they will turn into
<div role=“article”>Your Content</div>
HTML5 elements vs ARIA roles
Exercise 3: Screen Reader
github.com/jkup/learn-a11y
Semantic
HTML
There’s an element for that
Semantic Anti Patterns
Elements with inherited functionality
HTML Headers (option + ctrl + u)
Exercise 4: Semantic HTML
github.com/jkup/learn-a11y
ARIA
Accessible Rich Internet Applications
ARIA Example
<span class=“button”>Click Me</span>
Add role
<span role=“button” class=“button”>Click Me</span>
Add tabindex
<span tabindex=“0” role=“button” class=“button”>Click Me</span>
Add Interaction
<span
tabindex=“0” role=“button” class=“button”
onclick=“btnClicked()” onKeyUp=“btnClicked()”>
Click Me
</span>
aria-describedby
<button aria-label="Close" aria-describedby="descriptionClose" � onclick="myDialog.close()">X</button>�...�<div id="descriptionClose">Closing this window will discard any information entered and �return you back to the main page</div>
ARIA CSS Selectors
.dropdown[aria-expanded="false"] .icon::after {
content: '▶';
}
.dropdown[aria-expanded="true"] .icon::after {
content: '▼';
}
Live regions
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions
Exercise 5: Live Regions
github.com/jkup/learn-a11y
Color
Exercise 6: Colors
github.com/jkup/learn-a11y
TOOLS
For Accessibility Testing
Chrome Extension
Tenon.io
Accessible Color Palette
JavaScript Frameworks
WAI and WCAG
Web Accessibility Initiative Web Content Accessibility Guidelines
WAI publishes WCAG
Web Accessibility Initiative Web Content Accessibility Guidelines
3 Things You Can Do Right Now
@jkup
Let’s audit some sites!