Keynote: Web Accessibility: Making Websites Better For Everyone

A presentation at JavaScript Open Day Toronto in December 2015 in Toronto, ON, Canada by Stephanie Hobson

Slide 1

Slide 1

WEB ACCESSIBILITY: 
 MAKING WEBSITES BETTER FOR EVERYONE

Slide 2

Slide 2

WHAT IS WEB ACCESSIBILITY?

Slide 3

Slide 3

SCREEN READER Page has fifty-eight headings and two hundred seventy-one links BBC dash Homepage Link Graphic BBC Heading level two Heading level two BBC navigation List of nine items bullet Link News bullet Link Sport bullet Link Weather bullet Link Capital bullet Link Future bullet Link Shop bullet Link TV bullet Link Radio bullet Link More… List end

Slide 4

Slide 4

HIGH CONTRAST

Slide 5

Slide 5

HIGH CONTRAST

Slide 6

Slide 6

VOICE RECOGNITION

Slide 7

Slide 7

VOICE RECOGNITION

Slide 8

Slide 8

VOICE RECOGNITION

Slide 9

Slide 9

TRACKBALL

Slide 10

Slide 10

KEYBOARD

Slide 11

Slide 11

MOBILE

Slide 12

Slide 12

SWITCH
CONTROL

Slide 13

Slide 13

SWITCH
CONTROL

Slide 14

Slide 14

SWITCH
CONTROL

Slide 15

Slide 15

SWITCH
CONTROL

Slide 16

Slide 16

SWITCH
CONTROL

Slide 17

Slide 17

SWITCH
CONTROL

Slide 18

Slide 18

SWITCH
CONTROL

Slide 19

Slide 19

SWITCH
CONTROL

Slide 20

Slide 20

SWITCH
CONTROL

Slide 21

Slide 21

TRY IT YOURSELF Settings > ? > Accessibility NVDA / ChromeVox / VoiceOver High Contrast Theme Tu r n o f f y o u r m o u s e
Mouse with your elbows

Slide 22

Slide 22

YOU SHOULD CARE ABOUT ACCESSIBILITY

Slide 23

Slide 23

1: UX Content Information Architecture Interface Design

Slide 24

Slide 24

1: UX xkcd.com/773

Slide 25

Slide 25

2: HTML

Slide 26

Slide 26

2: HTML Semantic HTML When the HTML markup reinforces the meaning (aka semantics) of the information on the page.

Slide 27

Slide 27

<button type="submit"> Submit </button> ☺

Slide 28

Slide 28

<a href="#" tabindex="0" aria-role="button" onclick="myForm.submit(); return false;"> Submit </a> ☹

Slide 29

Slide 29

<button type="submit"> Submit </button> ☺

Slide 30

Slide 30

<a href="#" tabindex="0" aria-role="button" onclick="myForm.submit(); return false;"> Submit </a> ☹

Slide 31

Slide 31

2: HTML WCAG 2.0

(Web Content Accessibility Guidelines) wave.webaim.org

Slide 32

Slide 32

Section 508 Rehabilitation Act Americans with Disabilities Act Nat’l Federation of the Deaf vs. Netflix Inc ADA Department of Justice Advance Notice Of Proposed Rulemaking Charter of Rights and Freedoms Canadian Human Rights Act Ontarians with Disabilities Act Schedules I, I.I and II of the Financial Administration Act Title III

Slide 33

Slide 33

Section 508 Rehabilitation Act Americans with Disabilities Act Nat’l Federation of the Deaf vs. Netflix Inc ADA Department of Justice Advance Notice Of Proposed Rulemaking Charter of Rights and Freedoms Canadian Human Rights Act Ontarians with Disabilities Act Schedules I, I.I and II of the Financial Administration Act Title III

Slide 34

Slide 34

Ontarians with Disabilities Act For all public sector organizations, private organizations, and non-profit organizations with 50 or more employees: Since January 1, 2012 all new websites or redesigns of existing sites, must conform to WCAG 2.0, Level A.

Slide 35

Slide 35

Ontarians with Disabilities Act All* internet and web content published after January 1, 2012 must conform to WCAG 2.0 Level AA by January 1, 2021. * Exceptions include captions on live videos and audio descriptions for pre-recorded videos.

Slide 36

Slide 36

3: CSS

Slide 37

Slide 37

DON’T SCREW UP YOUR HTML Style the right element.

Slide 38

Slide 38

DON’T SCREW UP YOUR HTML Style the right element. Don’t remove outlines.

Slide 39

Slide 39

Slide 40

Slide 40

DON’T SCREW UP YOUR HTML Style the right element.
Don’t remove outlines. Don’t write in ALL CAPS.

Slide 41

Slide 41

MAKE SMALL IMPROVEMENTS Icon and colour hints. Text fallbacks. Larger hit areas.

Slide 42

Slide 42

4: JAVASCRIPT

Slide 43

Slide 43

DON’T SCREW UP YOUR HTML Respect focus()

Slide 44

Slide 44

Slide 45

Slide 45

DON’T SCREW UP YOUR HTML Respect focus() Keep users in control.

Slide 46

Slide 46

#DZY (It’s like #NSFW for people with vestibular disorders)

Slide 47

Slide 47

Slide 48

Slide 48

#SZR (It’s like #NSFW for people with epilepsy)

Slide 49

Slide 49

DON’T SCREW UP YOUR HTML Respect focus() Keep users in control.

Slide 50

Slide 50

MAKE SMALL IMPROVEMENTS ARIA Roles and Attributes (Accessible Rich Internet Applications)

Slide 51

Slide 51

Slide 52

Slide 52

Slide 53

Slide 53

<div class="server">Blueberry <span class="server_button"> DETAILS &#x25B8;</span> </div> <div class="server_details"> <div>Hostname: web02.onr.example.com</div> <div>Service Tag: JCQFZK1</div> <div>Datacentre: ONR</div> <div>Rack Location: 104.6, Unit #24</div> </div>

Slide 54

Slide 54

<div class="server">Blueberry <span class="server_button"> DETAILS &#x25B8;</span> </div> <div class="server_details"> <div> Hostname: web02.onr.example.com </div> <div> Service Tag: JCQFZK1 </div> <div> Datacentre: ONR </div> </div>

Slide 55

Slide 55

<div class="server">Blueberry <span class="server_button"> DETAILS &#x25B8;</span> </div> <dl class="server_details"> <dt> Hostname: </dt><dd> web02.onr.example.com </dd> <dt> Service Tag: </dt><dd> JCQFZK1 </dd> <dt> Datacentre: </dt><dd> ONR </dd> </dl>

Slide 56

Slide 56

<div class="server">Blueberry <span class="server_button"> DETAILS &#x25B8;</span> </div> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 57

Slide 57

<h3 class="server">Blueberry <span class="server_button"> DETAILS &#x25B8;</span> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 58

Slide 58

<h3 class="server">Blueberry <span class="server_button"> DETAILS &#x25B8; </span> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com< <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 59

Slide 59

$('.server_button').on( 'click' ,
function() {
$(this) .parent().next() .toggleClass('hide'); });

Slide 60

Slide 60

.server_button :hover { background-color: #000; color: #fff; }

Slide 61

Slide 61

<h3 class="server">Blueberry <span class="server_button"> DETAILS &#x25B8; </span> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com< <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 62

Slide 62

<h3 class="server">Blueberry <button class="server_button"> DETAILS &#x25B8; </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 63

Slide 63

<h3 class="server">Blueberry <button class="server_button" type="button"> DETAILS &#x25B8; </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 64

Slide 64

$('.server_button').on( 'click' ,
function() {
$(this) .parent() .next() .toggle(); });

Slide 65

Slide 65

.server_button :hover { background-color: #000; color: #fff; }

Slide 66

Slide 66

.server_button :hover, .server_button:focus { background-color: #000; color: #fff; }

Slide 67

Slide 67

.server_button:hover, .server_button:focus { background-color: #000; color: #fff;

text-decoration: underline; }

Slide 68

Slide 68

<h3 class="server">Blueberry <button class="server_button" type="button"> DETAILS &#x25B8; </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 69

Slide 69

<h3 class="server">Blueberry <button class="server_button" type="button"> Details &#x25B8; </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 70

Slide 70

<h3 class="server">Blueberry <button class="server_button" type="button"> Details &#x25B8; </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 71

Slide 71

<h3 class="server"> <button class="server_button" type="button"> Blueberry </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</ <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 72

Slide 72

Slide 73

Slide 73

<h3 class="server"> <button class="server_button" type="button"> Blueberry </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</ <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 74

Slide 74

<h3> <button class="server" type="button"> Blueberry </button> </h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 75

Slide 75

Slide 76

Slide 76

.server_button .server:after { content: 'Details \25B8’; text-transform: uppercase; speak: none;

background-color: #fff; border-radius: 4px; border: 0px none; box-shadow: 0px -2px
rgba(0,0,0, 0.5) inset; color: #4D4E53;

Slide 77

Slide 77

.server_button:hover, .server_button:focus .server:hover:after, .server:focus:after {

/* same styles as before */ }

Slide 78

Slide 78

Slide 79

Slide 79

Click here

Slide 80

Slide 80

“…the time required to rapidly move to a target area is a function of the ratio between the distance to the target and the width of the target” FITTS’ LAW

  • Wikipedia FTW

Slide 81

Slide 81

Slide 82

Slide 82

<span aria-hidden="true" class="icon_check"></span> <span class="offscreen"> This server is up: </span>

Slide 83

Slide 83

<span aria-hidden="true"

  class="icon_check"></span> 
<span class="offscreen"> This server is up: </span>

Slide 84

Slide 84

.icon_check:before { content: '\π3'; speak: none; } .icon_times:before { content: '\π5'; speak: none; }

Slide 85

Slide 85

<span aria-hidden="true" class="icon_check"></span> <span class="offscreen">

This server is up: </span>

Slide 86

Slide 86

Slide 87

Slide 87

<span aria-hidden="true" class="icon_check"></span> <span class="offscreen"

 This server is up: 
</span>

Slide 88

Slide 88

.offscreen { position: absolute; height: 1px; width: 1px; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);
}

Slide 89

Slide 89

Slide 90

Slide 90

Slide 91

Slide 91

WHAT JUST HAPPENED?

Slide 92

Slide 92

WHAT JUST HAPPENED?

  • choose the right element

Slide 93

Slide 93

WHAT JUST HAPPENED?

  • choose the right element
  • use descriptive calls to action

Slide 94

Slide 94

WHAT JUST HAPPENED?

  • choose the right element
  • use descriptive calls to action
  • make hit areas bigger

Slide 95

Slide 95

WHAT JUST HAPPENED?

  • choose the right element
  • use descriptive calls to action
  • make hit areas bigger
  • add visual cues in the CSS

Slide 96

Slide 96

WHAT JUST HAPPENED?

  • choose the right element
  • use descriptive calls to action
  • make hit areas bigger
  • add visual cues in the CSS
  • don’t just add visual cues

Slide 97

Slide 97

ARIA aria-controls aria-expanded

Slide 98

Slide 98

<h3>

<button class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button>

</h3> <dl class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 99

Slide 99

<h3>

<button aria-controls="raspberry" class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button>

</h3> <dl id="raspberry" class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 100

Slide 100

<h3>

<button aria-controls="raspberry" aria-expanded="false" class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button>

</h3> <dl id="raspberry" class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 101

Slide 101

<h3>

<button aria-controls="raspberry" aria-expanded="false" class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button>

</h3> <dl id="raspberry" class="hidden server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 102

Slide 102

$('[aria-expanded]') .on('click', function(){ var id = $(this).attr('aria-contols'); $(this).ariaToggle('aria-controls');
$('#' + id).toggle(); });

Slide 103

Slide 103

$.fn.ariaToggle = function(attr) { var $this = $(this); var currentValue = $this.attr(attr); if(currentValue === 'true'){ $this.attr(attr, false); } else { $this.attr(attr, true); } // make it so we can chain this function return this; };

Slide 104

Slide 104

<h3>

<button aria-controls="raspberry" aria-expanded="false" class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button>

</h3> <dl id="raspberry" class="hidden server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 105

Slide 105

<h3>

<button aria-controls="raspberry" aria-expanded="true" class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button>

</h3> <dl id="raspberry" style="display:block;" class="server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 106

Slide 106

.server[aria-expanded=false]:after{ content: 'Details \25B8'; } .server[aria-expanded=true]:after{ content: 'Details \25BE'; }

Slide 107

Slide 107

Slide 108

Slide 108

Slide 109

Slide 109

<h3> <button aria-controls="raspberry" aria-expanded="false" class="server" type="button"> <span aria-hidden="true" class="icon_check" ></span> <span class="offscreen">This server is up: </span> Blueberry </button> </h3> <dl id="raspberry" class="hidden server_details"> <dt>Hostname:</dt><dd> web02.onr.example.com</dd> <dt>Service Tag:</dt><dd> JCQFZK1</dd> <dt>Datacentre:</dt><dd> ONR</dd> </dl>

Slide 110

Slide 110

DON’T SELL IT, DO IT

Slide 111

Slide 111

BETTER FOR EVERYONE https://www.microsoft.com/design/practice#toolkit via @dstorey

Slide 112

Slide 112

Slide 113

Slide 113

I LIKE TO MAKE WEBSITES EVERYONE CAN USE @stephaniehobson stephaniehobson.ca

Slide 114

Slide 114

RESOURCES

  • webaim.org
  • wave.webaim.org
  • alistapart.com/article/the-accessibility-of-wai-aria
  • 24ways.org/2009/dont-lose-your-focus/
  • alistapart.com/article/designing-safer-web-animation-for-motion- sensitivity
  • filamentgroup.com/lab/bulletproof_icon_fonts.html
  • snook.ca/archives/html_and_css/hiding-content-for-accessibility
  • www.youtube.com/watch?v=GQKEE9nI1lk