1 of 125

The Web is for Everyone

An Introduction to Accessibility

2 of 125

Jon Kuperman

@jkup

3 of 125

Today we’ll be covering

  • Types of disabilities
  • Assistive technologies
  • Keyboard Navigation
  • Focus Control
  • Working with screen readers
  • Semantic HTML
  • WAI-ARIA
  • Accessibility in color and design

4 of 125

Similar Fields

5 of 125

6 of 125

7 of 125

8 of 125

Web accessibility means that people with disabilities can use the Web.

9 of 125

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.

10 of 125

Let’s Talk Numbers

11 of 125

About 56.7 million Americans — 19 percent of the population — had a disability in 2010

12 of 125

An estimated 7.9 million persons (age 6 and older) have difficulty seeing words and letters in ordinary newspaper print

Lighthouse International Research Study

13 of 125

Currently around 10 per cent of the total world's population, or roughly 650 million people, live with a disability.

14 of 125

The Web is

Already Accessible

even if your website is not

15 of 125

16 of 125

1991

17 of 125

Why

  • We’re making it inaccessible
  • Human Rights
  • Legal Issue
  • Reach a larger audience

Developers

should care

18 of 125

WebAIM Checklist

19 of 125

All websites should be

20 of 125

Types of Disabilities

21 of 125

So Many Ways

To Browse The Web

Mouth Sticks

Screen Readers

Magnification

Keyboard shortcuts

22 of 125

Keyboard Only

23 of 125

Head Wand and Mouthstick

24 of 125

Single Switch

25 of 125

Screen Reader

26 of 125

Let’s talk about

Keyboards

27 of 125

Keyboard

shortcuts

28 of 125

Twitter

29 of 125

Facebook

30 of 125

31 of 125

Keyboard

navigation

32 of 125

Tabbable

Elements

33 of 125

Shift + Tab Tab

34 of 125

  • <a>
  • <button>
  • <input>
  • <select>
  • <textarea>
  • <iframe>

35 of 125

Tabindex

36 of 125

<div tabindex=“0”>I’m focusable</div>

37 of 125

Tabindex Values

  • a negative value means that the element should be focusable, but should not be reachable via sequential keyboard navigation;
  • 0 means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention;
  • a positive value means should be focusable and reachable via sequential keyboard navigation; its relative order is defined by the value of the attribute: the sequential follow the increasing number of the tabindex. If several elements share the same tabindex, their relative order follows their relative position in the document.

38 of 125

39 of 125

Visible Focus

40 of 125

41 of 125

Skip links

42 of 125

43 of 125

44 of 125

Learn more about skip links

45 of 125

46 of 125

47 of 125

Setting up our project

github.com/jkup/learn-a11y

48 of 125

Exercise 1: Keyboard Navigation

  1. The form at the bottom can’t be submitted with just a keyboard.
  2. There is no “skip link” for tabbing straight into the content.

github.com/jkup/learn-a11y

bit.ly/2ly0XOJ

49 of 125

50 of 125

Focus

Control

51 of 125

document.activeElement

var currentElement = document.activeElement;

52 of 125

Tabtrapping

  • Select your modal
  • Find and select all focusable children (https://github.com/jkup/focusable)
  • Convert them to an Array
  • Find the first and last tabbable item inside the modal
  • Listen for keydown event
  • Check to see if it’s the tab key
  • *Also check if shift is being held down*
  • If moving forward and on the last item, focus the first item
  • If moving backward and on the first item, focus the last item

53 of 125

Element.focus()

if (document.activeElement === firstTabStop) {

e.preventDefault();

lastTabStop.focus();

}

54 of 125

Exercise 2: Focus Control

  1. When the modal appears, you are still able to tab through elements on the main page. Tabbable content should be restricted to the modal.
  2. Both hitting the escape key as well as clicking outside the modal should close it.

github.com/jkup/learn-a11y

55 of 125

Screen Readers

56 of 125

Most Popular Desktop Screen Readers

  1. JAWS (Windows)
  2. ZoomText (Mac and Windows)
  3. Window-Eyes (Windows)
  4. NVDA (Windows)
  5. VoiceOver (Mac)
  6. ChromeVox (Browser)

57 of 125

58 of 125

<img alt=“Alternate Text” />

59 of 125

60 of 125

What your users hear

61 of 125

62 of 125

What your users hear

63 of 125

64 of 125

Writing Good Alt Text

  • Be accurate
  • Be succinct
  • Don’t be redundant
  • Don’t use "image of" or "graphic of"

http://webaim.org/techniques/alttext/

65 of 125

Interesting Alt text tips

  • alt=”” intentionally skip element
  • alt=”UPPERCASE” individually reads letters

66 of 125

67 of 125

Hiding things from screen readers

  • display: none;
  • visibility: hidden;
  • <input hidden />

68 of 125

Hide from user but show to screen readers

.screenreader {

position: absolute;

left: -10000px;

width: 1px;

height: 1px;

overflow: hidden;

}

69 of 125

label

<label for="username">Click me</label><input type="text" id="username">

70 of 125

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>

71 of 125

72 of 125

ARIA Roles

73 of 125

HTML5 elements vs ARIA roles

Sometimes it’s nice to have both for older browsers

<article role=“article”>Your Content</article>

74 of 125

HTML5 elements vs ARIA roles

Which they will turn into

<div role=“article”>Your Content</div>

75 of 125

HTML5 elements vs ARIA roles

76 of 125

Exercise 3: Screen Reader

  • Your task is to make it so the entire form can be filled out with only the use of a screen reader.

github.com/jkup/learn-a11y

77 of 125

Semantic

HTML

78 of 125

79 of 125

There’s an element for that

80 of 125

Semantic Anti Patterns

  • <div class=”button”></div>
  • <span class=”checkbox”></span>
  • <img src=”3443.jpg” />

81 of 125

Elements with inherited functionality

82 of 125

HTML Headers (option + ctrl + u)

83 of 125

Exercise 4: Semantic HTML

  • Check the ARIA roles and see if you can find HTML5 elements to replace roles.
  • Make sure all items are using the proper elements.

github.com/jkup/learn-a11y

84 of 125

85 of 125

86 of 125

ARIA

Accessible Rich Internet Applications

87 of 125

ARIA Example

<span class=“button”>Click Me</span>

88 of 125

Add role

<span role=“button” class=“button”>Click Me</span>

89 of 125

Add tabindex

<span tabindex=“0” role=“button” class=“button”>Click Me</span>

90 of 125

Add Interaction

<span

tabindex=“0” role=“button” class=“button”

onclick=“btnClicked()” onKeyUp=“btnClicked()”>

Click Me

</span>

91 of 125

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>

92 of 125

ARIA CSS Selectors

.dropdown[aria-expanded="false"] .icon::after {

content: '▶';

}

.dropdown[aria-expanded="true"] .icon::after {

content: '▼';

}

93 of 125

Live regions

  • aria-live - off/polite/assertive
  • aria-relevant - additions/removals/text/all

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions

94 of 125

Exercise 5: Live Regions

  1. Write some JavaScript in aria.js to give increment and decrement functionality.
  2. Use ARIA live regions so that screen readers announce when the count changes.

github.com/jkup/learn-a11y

95 of 125

Color

96 of 125

97 of 125

98 of 125

Exercise 6: Colors

  • Experiment with our demo site and other sites.
  • What color schemes seem dangerous to use?

github.com/jkup/learn-a11y

99 of 125

100 of 125

TOOLS

For Accessibility Testing

101 of 125

Chrome Extension

102 of 125

103 of 125

104 of 125

Tenon.io

105 of 125

106 of 125

107 of 125

108 of 125

109 of 125

110 of 125

Accessible Color Palette

111 of 125

112 of 125

113 of 125

114 of 125

115 of 125

116 of 125

117 of 125

118 of 125

119 of 125

JavaScript Frameworks

120 of 125

121 of 125

122 of 125

WAI and WCAG

Web Accessibility Initiative Web Content Accessibility Guidelines

123 of 125

WAI publishes WCAG

Web Accessibility Initiative Web Content Accessibility Guidelines

124 of 125

3 Things You Can Do Right Now

  1. Audit your site
  2. Check your color scheme
  3. Join the community!

@jkup

125 of 125

Let’s audit some sites!