Are JavaScript frameworks bad for accessibility? @jessbudd4
Slide 8
“
Nothing in React prevents us from building accessible web apps - Leslie Cohn-Wein, Netlify
@jessbudd4
Slide 9
What is web accessibility? @jessbudd4
Slide 10
Removing barriers that prevent people with disabilities using your website @jessbudd4
Slide 11
1 5 in
Australians experience some form of disability
Source: www.and.org.au/pages/disability-statistics.html
@jessbudd4
Slide 12
357,000 Australians have a visual impairment
Source: www.and.org.au/pages/disability-statistics.html
@jessbudd4
Slide 13
1 in 6 Australians are affected by hearing loss
Source: www.and.org.au/pages/disability-statistics.html
@jessbudd4
Slide 14
Vision Hearing Mobility Cognitive @jessbudd4
Slide 15
Credit: Undraw and Ben Usher Smith
@jessbudd4
Slide 16
Accessibility benefits everyone @jessbudd4
Slide 17
Who is most impacted?
Slide 18
Keyboard users
Slide 19
Screenreade r users
Slide 20
Semantic HTML @jessbudd4
Slide 21
Why does it matter?
@jessbudd4
Slide 22
screenshot of link list @jessbudd4
Slide 23
// not very accessible card component <div class=”product”> <div class=“name”> Product name </div> <div class=”description”> Description of product </div> <div class=”button”>Add to cart</div> </div>
Slide 24
Slide 25
// more accessible card component <li> <h2> Product name </h2> <p> Description of product </p> <button>Add to cart</button> </li>
Slide 26
Divs are not buttons @jessbudd4
Slide 27
<div tabindex=”0” role=”button” onKeyUp={keyUpHandler} onClick={clickHandler} class=”button”> Add to cart </div>
Slide 28
<div tabindex=”0” role=”button” onKeyUp={keyUpHandler} onClick={clickHandler} class=”button”> Add to cart </div>
Slide 29
<div tabindex=”0” role=”button” onKeyUp={keyUpHandler} onClick={clickHandler} class=”button”> Add to cart </div>
Slide 30
<div
<button
tabindex=”0”
onClick={clickHandler}>
role=”button”
Add to cart
onKeyUp={keyUpHandler}
</button>
onClick={clickHandler} class=”button”> Add to cart </div>
👍
// label not linked to input <label> Dog breed: </label> <input type=”text” name=”breed” />
Slide 39
// explicitly linked label to input <label for=”uniqueId”> Dog breed: </label> <input id=”uniqueId” type=”text” name=”breed” />
Slide 40
// “for” becomes “htmlFor” in JSX <label htmlFor=”uniqueId”> Dog breed: </label> <input id=”uniqueId” type=”text” name=”breed” />
Slide 41
What if I can’t set a unique ID in advance?
@jessbudd4
Slide 42
// implicitly linked label to input <label> Dog breed: <input type=”text” name=”breed”/> </label>
Slide 43
What if the design doesn’t have labels?
@jessbudd4
Slide 44
// label hidden with css is still announced <label class=“sr-only“ for=“dogBreed”> Dog breed: </label> <input id=“dogBreed” type=”text” name=”breed” />
Tabindex Explained // tabindex becomes tabIndex (camelCase) in JSX tabindex=”0”
// makes element focusable in tab/DOM order
tabindex=”-1”
// makes elements focusable only via scripting
tabindex=”5”
// Danger Will Robinson!
“
Automated testing is just the first step - Manuel Matuzovic
@jessbudd4
Slide 82
Testing @jessbudd4
Slide 83
Keyboard
@jessbudd4
Slide 84
What to look for Can I see where focus is? Does the tab order make sense? Can I access all required elements? Can I use advanced components? Does my focus move when needed? @jessbudd4