Spinning ARIA Around

A presentation at John Slatin AccessU in May 2019 in Austin, TX, USA by Eric Eggert

Slide 1

Slide 1

Spinning ARIA Around

Eric Eggert, Knowbility · AccessU · May 2019

Slide 2

Slide 2

Eric Eggert

Eric Eggert is a Web Developer and Teacher who works with Knowbility and the W3C on improving the Web for People with Disabilities, and everyone else.

My name is Eric Eggert and I work with Knowbility and the W3C to improve the Web for People with Disabilities. I work with Knowbility and they donate 50% of my work time to W3C as a fellowship.

Slide 3

Slide 3

Important Note:

This presentation contains ARIA examples that are preventing websites and applications from being accessible.

Don’t copy & paste mindlessly.

Slide 4

Slide 4

WAI-ARIA: Accessible Rich Internet Applications

Slide 5

Slide 5

Internet Applications

Slide 6

Slide 6

Internet Applications

Slide 7

Slide 7

ARIA ≠ 🧙‍♀️|| 🧙‍♂️

ARIA is not witchcraft or sorcery.

Slide 8

Slide 8

No aria-make-accessible=”true”

Slide 9

Slide 9

5 Rules of ARIA

Using ARIA

Slide 10

Slide 10

Rule 1

If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of repurposing an element and adding an ARIA role, state or property to make it accessible, then do so.

Slide 11

Slide 11

Rule 2

Do not change native semantics, unless you really have to.

Slide 12

Slide 12

Bad Example:

<h1 role="button">heading button</h1>

Good Example:

<h1><button>heading button</button></h1>

Slide 13

Slide 13

Nicolas Steenhout @vavroom:

Here’s an accessibility gem: <h2 class="h3" role="heading" aria-level="1">Some heading</h2> #a11y

on Twitter

Slide 14

Slide 14

Rule 3

All interactive ARIA controls must be usable with the keyboard.

Slide 15

Slide 15

Rule 3

If you create a widget that a user can click or tap or drag or drop or slide or scroll, a user must also be able to navigate to the widget and perform an equivalent action using the keyboard. All interactive widgets must be scripted to respond to standard keystrokes or keystroke combinations where applicable.

Slide 16

Slide 16

Example

If using role=button the element must be able to receive focus and a user must be able to activate the action associated with the element using both the enter (on WIN OS) or return (MAC OS) and the space key. — ARIA Practices Guide

Slide 17

Slide 18

Slide 18

Rule 4

Do not use role="presentation" or aria-hidden="true" on a focusable element. Using either of these on a focusable element will result in some users focusing on ‘nothing’.

Slide 19

Slide 19

Rule 5

All interactive elements must have an accessible name.

Slide 20

Slide 20

Some Roles

<div role="main"> <!-- better: <main> -->
<form role="search">
<div role="tooltip">
<output role="alert">

Slide 21

Slide 21

Some Properties and States

<input aria-required="true">
<input aria-labelledby="label" aria-describedby="errormsg">
<button aria-expanded="false">
<div aria-hidden="true">
<div aria-live="assertive">

Slide 22

Slide 22

Live Regions

<div aria-live="off">
<div aria-live="polite">
<div aria-live="assertive">

Slide 23

Slide 23

ARIA Support

Slide 24

Slide 24

Heydon Pickering: aria-controls is 💩

Slide 25

Slide 25

The many roles and properties of ARIA.

RDF Model of WAI-ARIA

Slide 26

Slide 26

WAI-ARIA is really Complicated!

Slide 27

Slide 27

Makes it also complicated for Web Developers!

Slide 28

Slide 28

Exhibit 1 – Bad!

<a id="airline-logo" href="…"
   class="logo"
   aria-label="Airline Name">
   &nbsp;
</a>

Slide 29

Slide 29

Exhibit 1 – Better!

<a id="logo" href="…">
   <img src="…" alt="Airline Name">
</a>

or:

<a id="logo" href="…">
   <svg>
     <title>Airline Name</title>
     …
   </svg>
</a>

Slide 30

Slide 30

Exhibit 2 – Bad!

<div class="nav">
  <a href="javascript:void(0);" class="navInactive" role="button">
    <span class="hiddenText">Slide 1</span>
  </a>
  <a href="javascript:void(0);" class="navActive" role="button">
    <span class="hiddenText">Slide 2</span>
  </a>
  <a href="javascript:void(0);" class="navInactive" role="button">
    <span class="hiddenText">Slide 3</span>
  </a>
</div>

Slide 31

Slide 31

Exhibit 2 – **Better!**

<nav>
  <button aria-pressed="false" aria-label="Slide 1">
     &nbsp;
  </button>
  <button aria-pressed="true" aria-label="Slide 2">
     &nbsp;         
  </button>
  <button aria-pressed="false" aria-label="Slide 3">
     &nbsp;
  </button>
</nav>

Slide 32

Slide 32

Exhibit 2 – **Even Better!**

<nav>
  <button aria-pressed="false">
   <img src="…" alt="Slide 1">
  </button>
  <button aria-pressed="true">
   <img src="…" alt="Slide 2">
  </button>
  <button aria-pressed="false">
   <img src="…" alt="Slide 3">
  </button>
</nav>

Slide 33

Slide 33

Exhibit 3 – Bad!

<th 
 tabindex="0" 
 role="button" 
 aria-label="Sort column"
>Name</th>

Slide 34

Slide 34

Exhibit 3a – Bad!

<button type="button" role="button" aria-required="false" tabindex="0">2</button> WHAT THE HECK? #facepalm #a11y

Paul J. Adam on Twitter

Slide 35

Slide 35

Exhibit 4 – Bad!*

<span aria-hidden="true" role="img" class="icon"> </span>

*Actually not harmful, but really, what is the point?!

Slide 36

Slide 36

Exhibit 5 – Really Bad!

<body aria-hidden="true">

Slide 37

Slide 37

Exhibit 6 – Bad!

<a 
  href="…" 
  target="_blank" 
  title="Click here to 
         view the video." 
  tabindex="-1" 
  role="button" 
  aria-label="External link"
></a>

Slide 38

Slide 38

Things you should not do: use an aria-live region on a carousel. Screen readers get constantly disrupted because the content changes. Makes your website impossible to use.

#ariaserious

Eric Eggert on Twitter

Slide 39

Slide 39

<label for="ID">Label Text</label><input type="text" id="id" />

Is not accessible. IDs are case sensitive in HTML/the DOM.

#ariaserious #htmlserious

Eric Eggert on Twitter

Slide 40

Slide 40

WAI-ARIA Authoring Practices 1.1

https://www.w3.org/TR/wai-aria-practices-1.1/

Slide 41

Slide 41

Using ARIA

https://www.w3.org/TR/using-aria/

Slide 42

Slide 42

Conclusion

  • ✅ Landmarks
  • ✅ States & Properties (Widget)
  • ⚠️ Roles — Mind the Keyboard