183
wai-aria AN INTRODUCTION TO ACCESSIBLE RICH INTERNET APPLICATIONS Patrick H. Lauke / Version 1.0.24012015

WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Embed Size (px)

Citation preview

Page 1: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

wai-ariaAN INTRODUCTION TO ACCESSIBLE RICH INTERNET APPLICATIONS

Patrick H. Lauke / Version 1.0.24012015

Page 2: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

what is ARIAand why do we need it?

Page 3: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

the problem

it's "easy" (in most cases) to make static web content accessible, butnowadays the web strives to be an application platform

complex web applications require structures (e.g. interactive controls)that go beyond what regular HTML offers (though some of thisintroduced with HTML5 ... more on that later)

Page 4: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

jQuery UI

Page 5: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Polymer Project

Page 6: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

the problem

when building interactive controls, some (too many) web developersgo "all out" on the JavaScript/CSS, but ignore/sidestep regular HTMLcontrols completely

Page 7: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div onclick="...">Test</div>

faked button

Page 8: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div tabindex="0"onclick="...">Test</div>

faked button with focus

Page 9: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div tabindex="0"onkeyup="..."

onclick="...">Test</div>

faked button with focus and keyboard handling

Page 10: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

for a sighted mouse/keyboarduser

this is a button...

Page 11: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

...but what about ascreenreader user?

Page 13: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

more complex examples...

Page 14: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

jQuery UI - Slider

What's the experience here for assistive technology users?

Page 15: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

the problem

generic/inappropriate HTML elements, with extra JavaScript/CSS ontop...but they're still recognised and exposed as <span> , <div> , etc

Page 16: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Operating systems and other platforms provide interfaces that exposeinformation about objects and events to assistive technologies

Java Accessibility API [JAPI], Microsoft Active Accessibility [MSAA], the Mac OS XAccessibility Protocol [AXAPI], the Gnome Accessibility Toolkit (ATK) [ATK], and

IAccessible2 [IA2]

Page 17: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Marco Zehe: Why accessibility APIs matter

Page 18: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

assistive technologies

Page 19: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

assistive technologies

•   NVDA (free)

•   Narrator (free)

•   JAWS

•   ZoomText

•   Dragon NaturallySpeaking

•   VoiceOver (free)

•   TalkBack (free)

•   ...

Page 20: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Léonie Watson - Basic screen reader commands for accessibilitytesting

Page 21: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

inspection tools

Page 22: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

inspection tools

test using assistive technologies (e.g. screenreaders), however...

assistive technologies often use heuristics to repairincomplete/broken accessibility API information - so we want tocheck what's actually exposed to the OS/platform.

of course, browsers also have bugs/incomplete support...

Page 24: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

chrome://accessibility view of the raw accessibility tree

Page 25: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Accessibility Viewer (aViewer)

Page 26: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

James Craig - Using ARIA 1.0 and the WebKit Accessibility NodeInspector

Page 27: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Xcode Accessibility Inspector(but for Chrome, remember to turn on accessibility mode in chrome://accessibility)

Page 29: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 30: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 31: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

if you use custom (notstandard HTML) widgets,

use ARIA to ensure correct infois exposed

Page 32: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

what is ARIA?

Page 33: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

W3C - Accessible Rich Internet Applications (WAI-ARIA) 1.0

Page 34: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA defines HTML attributesto convey correct role, state,

properties and value

Page 35: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 36: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

W3C - WAI-ARIA 1.0 - 5.3.1 The Roles Model

Page 37: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 38: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

W3C - WAI-ARIA 1.0 - 6. Supported States and Properties

Page 39: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

what information does ARIA provide?

•   role: what type of widget is this? (e.g. 'slider')

•   state: what is its situation? (e.g. 'disabled')

•   identity: what does it represent? (e.g. 'volume control')

this information is mapped by the browser to the operating system'saccessibility API and exposed to assistive technologies.

extra benefit: AT will (may) automatically announce widget-specifichints and prompts (e.g. JAWS "... button - to activate, press SPACEbar")

Page 40: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div tabindex="0"role="button" onkeyup="..."onclick="...">Test</div>

faked button with appropriate role

Page 41: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 42: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

use ARIA to:

•   make custom widgets understandable to assistive technology users

•   programmatically indicate relationships between elements

•   notify users of dynamic updates

•   hide irrelevant visible content from assistive technology

•   remediation of inaccessible content without completely recoding

Page 43: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA roles and attributes: restrictions

•   certain role s only make sense as part of a specific complex widget

•   some aria-* attributes are global

•   other aria-* attributes only make sense for particular role

•   not all roles/attributes are supported/implemented consistentlyeverywhere

Page 44: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

what ARIA doesn't do...

ARIA is not magic: it only changes how assistive technologyinterprets content.

•   make an element focusable

•   provide keyboard events

•   add properties

•   change visible appearance

all of this is still your responsibility...

Page 45: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA support: browsers

•   Firefox 3+

•   Internet Explorer 8+

•   Safari 4+ (Mac)

•   Chrome 17+

Page 46: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA support: assistive technologies

•   JAWS 8+ (Win)

•   Windows Eyes 5.5+ (Win)

•   ZoomText

•   VoiceOver (OS X/iOS)

•   NVDA (Win)

•   ORCA (Linux)

Page 47: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA support: libraries

•   extJS

•   jQuery

•   Dojo

•   GWT

•   ...

Page 48: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

"support" does not mean thateverything works, though...

Page 49: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

In principle ARIA works in all markup languages...but obviously thatdepends on user agent/AT support. We'll focus on ARIA and HTML

Sidenote: Using ARIA to enhance SVG accessibility

Page 50: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

using WAI-ARIA in HTML

Page 51: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

W3C - Using WAI-ARIA in HTML

Page 52: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

the 5 rules of ARIA use

Page 53: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

1. don't use ARIA

Page 54: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 55: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

If you can use a native HTML element [HTML5] or attribute with thesemantics and behaviour you require already built in, instead of re-purposing an element and adding an ARIA role, state or property tomake it accessible, then do so.“

Page 56: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

2. don't change nativesemantics

unless you really have to / know what you're doing

Page 57: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

don't do this:<h1 role="button">heading button</h1>

do this instead:<h1><span role="button">heading button</span></h1>

otherwise the heading is no longer a heading(e.g. AT users can't navigate to it quickly)

Page 58: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

don't do this:<ul role="navigation"> <li><a href="...">...</a></li> ...</ul>

do this instead:<div role="navigation"> <ul> <li><a href="...">...</a></li> ... </ul></div>

otherwise the list is no longer a list(e.g. AT won't announce "list with X items...")

Page 59: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

3. make interactive ARIAcontrols keyboard accessible

Page 60: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

All interactive widgets must be focusable and scripted to respond tostandard key strokes or key stroke combinations where applicable. [...]

Refer to the keyboard and structural navigation and design patternssections of the WAI-ARIA 1.0 Authoring Practices

Page 61: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

4. don't "neutralise" focusableelements

Page 62: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

don't use role="presentation" or aria-hidden="true" on a visiblefocusable element. Otherwise, users will navigate/focus onto"nothing".

<!-- don't do this... -->

<button role="presentation">press me</button>

<button aria-hidden="true">press me</button>

<span tabindex="0" aria-hidden="true">...</span>

Page 63: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

5. interactive elements musthave an accessible name

Page 64: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- don't do this... -->

<span tabindex="0" role="button"> <span class="glyphicon glyphicon-remove-sign"></span></span>

Page 65: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" role="button" aria-label="Delete" > <span class="glyphicon glyphicon-remove-sign"></span></span>

<span tabindex="0" role="button" title="Delete" > <span class="glyphicon glyphicon-remove-sign"></span></span>

<span tabindex="0" role="button"> <span class="glyphicon glyphicon-remove-sign"> <span class="...">Delete</span> </span></span>

refer to WAI-ARIA 1.0 - 5.2.7. Accessible Name Calculation

Page 66: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

WAI-ARIA spec can be dry/technical - use for referenceW3C - WAI-ARIA 1.0 Authoring Practices more digestible.

Page 67: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA and HTML5

Page 68: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA is used whenbuilding/denoting things that

native HTML can't do

Page 69: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

HTML5 introduces newelements, element types,

attributes that solve some ofthese situations

Page 71: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

HTML5 accessibility

Page 72: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Implementation status for HTML5 element/attribute accessibilitymappings

Page 73: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

HTML5 now also includes WAI-ARIA ...

Page 74: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

... meaning we can validate pages with (static) ARIA validator.w3.org

Page 75: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

common structures and widgets

(not an exhaustive list - enough to understand concepts)

Page 76: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

using ARIA to providestructure

Page 77: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

heading

Page 78: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<p class="heading1">Heading 1</p>...<p class="heading2">Heading 2</p>...<p class="heading3">Heading 3</p>...

Page 79: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<p class="heading1" role="heading" aria-level="1" >Heading 1</p>...<p class="heading2" role="heading" aria-level="2" >Heading 2</p>...<p class="heading3" role="heading" aria-level="3" >Heading 3</p>...

example: headings

•   add role="heading"

•   if more than one hierarchical level, and can't be inferred fromstructure, add explicit aria-level

Page 80: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

list

Page 81: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div> <div>...</div> <div>...</div> <div>...</div> ...</div>

generally more complex (big markup structures that boil down toessentially "a list of things...")

Page 82: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="list" > <div role="listitem" >...</div> <div role="listitem" >...</div> <div role="listitem" >...</div> ...</div>

example: list/listitem

•   add role="list" and role="listitem"

Page 83: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

landmarks

Page 84: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

adapted from HTML5 Doctor - Designing a blog with html5

Page 85: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 86: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

why define landmarks?

•   users of assistive technologies can more easily find areas of yourpage/app

•   AT keyboard controls to navigate to/between landmarks

•   overview dialogs listing all landmarks (e.g. NVDA)

Page 87: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 88: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

doesn't HTML5 solve this?

Page 89: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

adapted from HTML5 Doctor - Designing a blog with html5

Page 90: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 91: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

using ARIA forsimple/standalone widgets

Page 92: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

button

Page 93: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" class="...">Button?</span>

example: button

Page 94: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" role="button" class="...">Button!</span>

•   add role="button"

•   make sure it's focusable

•   add handling of SPACE

Page 95: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

toggle button

Page 96: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" class="...">Option</span>

<span tabindex="0" class="... pressed">Option</span>

example: [TODO] span and fixed with ARIA

Page 97: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" role="button" aria-pressed="false" class="...">Option</span>

<span tabindex="0" role="button" aria-pressed="true" class="... pressed">Option</span>

•   add role="button"

•   make sure it's focusable

•   add handling of SPACE

•   add aria-pressed and dynamically change its value

Page 98: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

checkbox

Page 99: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" class="...">Option</span>

<span tabindex="0" class="... checked">Option</span>

example: checkbox

Page 100: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" role="checkbox" aria-checked="false" class="...">Option</span>

<span tabindex="0" role="checkbox" aria-checked="true" class="... checked">Option</span>

•   add role="checkbox"

•   make sure it's focusable

•   add handling of SPACE

•   add aria-checked and dynamically change its value

similar to toggle button, but announced differently by AT

Page 101: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

aria-checked="true"

aria-checked="false"

aria-checked="mixed" <!-- "partially" checked -->

example: tri-state checkbox

Page 102: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

radio button

Page 103: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" class="...">Yes</span><span tabindex="0" class="... selected">No</span><span tabindex="0" class="...">Maybe</span>

example: radio button

Page 104: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="-1" role="radio" aria-checked="false" class="...">Yes</span><span tabindex="0" role="radio" aria-checked="true" class="... selected">No</span><span tabindex="-1" role="radio" aria-checked="false" class="...">Maybe</span>

•   add role="radio"

•   only single tab-stop (as with native radio buttons)

•   add handling of SPACE and cursor keys

•   add aria-checked and dynamically change its value

•   should be contained inside role="radiogroup" (cfr. <fieldset> )

Page 105: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

link

Page 106: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" onclick="document.location(...)">link</span>

Page 107: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" role="link" onclick="document.location(...)">link</span>

•   add role="link"

•   make sure it's focusable

•   ensure correct ENTER keyboard handling

Page 108: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

tooltip

Page 109: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" onmouseover="..." onfocus="...">...</span>...<span>this is the tooltip text</span>

Page 110: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span tabindex="0" onmouseover="..." onfocus="..." aria-describedby="tooltip" >...</span>...<span role="tooltip" id="tooltip"> this is the tooltip text</span>

example: tooltip

•   add role="tooltip" (but seems to have no effect in AT)

•   add aria-describedby pointing to id of tooltip

Page 111: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

status bar

Page 112: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span role="status" > some form of status bar message...</span>

example: status bar

•   add role="status" (varying support?)

•   an example of a live region (more on this later)

Page 113: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

alert message

Page 114: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<span role="alert" > an alert message (no user interaction)</span>

example: alert

•   add role="alert" (varying support?)

•   an example of a live region (more on this later)

Page 115: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

progress bar

Page 116: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div> <span style="width:40%"></span></div>

Page 117: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div tabindex="0" role="progressbar" aria-label="..." aria-valuemin="0" aria-valuemax="100" aria-valuenow="40" aria-valuetext="40% complete" > <span style="width:40%"></span></div>

example: progress bar

•   add role="progressbar" (varying support?)

•   add aria-valuemin , aria-valuemax , aria-valuenow

•   optional aria-valuetext

•   make it keyboard-focusable

•   should have a name/label, e.g. aria-label

Page 118: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

slider

Page 119: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- taken from jQueryUI -->

<div ... class="ui-slider ..."> <span class="ui-slider-handle ..." tabindex="0" style="left: 7%;"></span></div>

example: standard jQueryUI slider

Page 120: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div ... class="ui-slider ..." role="slider" aria-valuemin="0" aria-valuemax="100" aria-valuenow="40" aria-valuetext="40%" > <span class="ui-slider-handle ..." tabindex="0" style="left: 40%;"></span></div>

•   add role="slider"

•   add aria-valuemin , aria-valuemax , aria-valuenow

•   optional aria-valuetext

•   ensure it handles cursor keys correctly

•   should have a name/label, e.g. aria-label

Page 121: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Hans Hillen's Accessible jQuery-ui Components Demonstration

Page 122: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

dialog

Page 123: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="dialog" tabindex="0" aria-labelledby="dialog-header" > <div id="dialog-header">My custom dialog</div> ...</div>

example: jQueryUI dialog (enhanced)

Page 124: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Karl Groves - a11yDialog

Page 125: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

using ARIA forcomplex/composite widgets

Page 126: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

menu

Page 127: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="menu" </div> <div role="menuitem" ...>...</div> <div role="menuitem" ...>...</div> <div role="menuitem" ...>...</div> ...</div>

Page 128: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="menubar" > <div role="menuitem" ...> ... <div role="menu" </div> <div role="menuitem" ...>...</div> <div role="menuitem" ...>...</div> <div role="menuitem" ...>...</div> ... </div> </div> ...</div>

example: Open Ajax Alliance - Menubar

most suitable for real "application-like" web-apps - arguably notappropriate for general "website navigation"

Page 129: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

W3C - Web Accessibility Tutorials - Web Application Menus

Page 132: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Heydon Pickering - Practical ARIA - Simple dropdowns

Page 133: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

tabs / accordions

Page 134: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="tablist" ...> <div role="tab" aria-controls="panel1" aria-selected="true" ...>Tab 1</div> <div role="tab" aria-controls="panel2" ...>Tab 2</div> <div role="tab" aria-controls="panel3" ...>Tab 2</div></div>

<div role="tabpanel" id="panel1" aria-hidden="false" >...</div><div role="tabpanel" id="panel2" aria-hidden="true" >...</div><div role="tabpanel" id="panel3" aria-hidden="true" >...</div>

example: Open Ajax Alliance: Tab Panel

variations on this theme: Marco Zehe - Advanced ARIA tip #1: Tabs inweb apps

not appropriate if you're just marking up a site navigation...

Page 135: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="tablist" ...> <div role="tab" aria-controls="panel1" ...>Tab 1</div> <div role="tabpanel" id="panel1">...</div> <div role="tab" aria-controls="panel2" ...>Tab 2</div> <div role="tabpanel" id="panel2">...</div> <div role="tab" aria-controls="panel3" ...>Tab 2</div> <div role="tabpanel" id="panel3">...</div></div>

example: Hans Hillen - Accessible jQuery-ui Components: Accordion

sometimes better to keep it simple (series of expand/collapsecontrols): whatsock - AccDC Technical Style Guide / AccDC TechnicalStyle Guide (GitHub)

Page 136: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

listbox

Page 137: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<div role="listbox" aria-activedescendant="opt2" tabindex="0"> <div role="option" id="opt1">Option 1</div> <div role="option" id="opt2" class="active">Option 2</div> <div role="option" id="opt3">Option 3</div></div>

example: James Craig - multiselect listbox

•   add role="listbox" on the container

•   add role="option" on each option

•   implement standard keyboard interaction (complex for multiselect)

•   use aria-activedescendant to manage focus (more later)

Page 138: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

combobox

Page 139: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- similar to <select> --><input type="text" role="combobox" aria-expanded="true" aria-autocomplete="list" aria-owns="optlist" aria-activedescendant="opt2" >

<div role="listbox" id="optlist"> <div role="option" id="opt1">Option 1</div> <div role="option" id="opt2" class="active">Option 2</div> <div role="option" id="opt3">Option 3</div></div>

example: Open Ajax Alliance: Combobox with aria-autocomplete=list

•   combination of focusable text input and listbox (likeautocomplete/search suggestions)

Page 140: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

tree

Page 141: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- list with selectable items, expand/collapse, nesting --><div role="tree" > <div role="treeitem" >...</div> <div role="treeitem" >...</div> <div role="treeitem" >... <div role="group" > <div role="treeitem" >...</div> <div role="treeitem" >...</div> </div> </div> ...</div>

example: Tree example (no ARIA used) / Tree example (with ARIA)

support very poor on mobile (as with many complex ARIA widgets)!

Page 142: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

grid

Page 143: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- interactive table/spreadsheet --><div role="grid" > <div role="row" > <div role="columnheader" >...</div> <div role="columnheader" >...</div> </div> <div role="row" > <div role="gridcell" >...</div> <div role="gridcell" >...</div> </div> ...</div>

example: Open Ajax Alliance: Grid example

sometimes better to simplify: Dennis Lembree - Interactive elementswithin a grid layout

Page 144: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

managing focus and keyboardinteractions

Page 145: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

the basics

to be usable – all interactive controls must be:

•   focusable

•   in the logical tab order

•   visible when they receive focus

•   have a clear indication of focus

•   operable with the keyboard

•   no focus trap

•   focus does not cause a change of context

Page 146: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

problem with custom controls

•    <div> , <span> etc. are not standard controls with defined behaviors

•   not focusable with keyboard by default

Page 147: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

solution

•   ideally, use native focusable HTML controls ( <a> , <button> , etc.)

•   or add tabindex="0" , appropriate role , and manually handlekeyboard interactions

Page 148: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

complex widgets and focus

•   generally, complex widgets (group of radio buttons, menus, listboxes,tab lists) only have a single "tab stop"

•   interactions within the widget handled programmatically

•    TAB / SHIFT + TAB moves to the next widget, not to sub-components

Page 149: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

keyboard navigation within widgets

•   either: "roving" tabindex (only one element inside widget hastabindex="0" , all others tabindex="-1" )

•   or: focus remains on widget itself, denote active child element witharia-activedescendant (and manually scroll into view, provide

highlight via CSS)

not all complex widgets lend themselves to "roving" tabindex - e.g.role="combobox" needs aria-activedescendant , as actual focus

must remain inside the textbox.

W3C WAI-ARIA 1.0 Authoring Practices - 3.1.3. Keyboard Navigationwithin Widgets

Page 150: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- roving tabindex example --><div role="radiogroup"> <div role="radio" aria-checked="true" tabindex="0" ...> ... <div role="radio" aria-checked="false" tabindex="-1" ...> ... <div role="radio" aria-checked="false" tabindex="-1" ...> ...</div>

only one radio button inside the group has focus

Page 151: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- roving tabindex example --><div role="radiogroup"> <div role="radio" aria-checked="false" tabindex="-1" ...> ... <div role="radio" aria-checked="true" tabindex="0" ...> ... <div role="radio" aria-checked="false" tabindex="-1" ...> ...</div>

changing the selection dynamically changes tabindex , aria-checked and sets focus() on the newly selected radio button

Page 152: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- activedescendant example --><div role="radiogroup" tabindex="0" aria-activedescendant="rad1" > <div role="radio" id="rad1" aria-checked="true" ...> ... <div role="radio" id="rad2" aria-checked="false" ...> ... <div role="radio" id="rad3" aria-checked="false" ...> ...</div>

radiogroup itself takes focus - selected radio button only identifiedvia aria-activedescendant

Page 153: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

<!-- activedescendant example --><div role="radiogroup" tabindex="0" aria-activedescendant="rad2" > <div role="radio" id="rad1" aria-checked="false" ...> ... <div role="radio" id="rad2" aria-checked="true" ...> ... <div role="radio" id="rad3" aria-checked="false" ...> ...</div>

changing the selection dynamically changes aria-activedescendant on the radiogroup , aria-checked on the radiobutton - but focus still remains only on the radiogroup

Page 154: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Medialize - ally.js

Page 155: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

live regions

Page 156: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

making AT aware of content changes

best way to notify users of assistive technologies of new content (anew element added to the page, made visible, a change in text) is tomove focus() programmatically to it.

but this is not always possible, as it would interrupt the user's currentactions...

example: faked button with notification via focus()

Page 157: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA live regions

•   announce a change on content without moving focus to it

•    aria-live : off , polite , assertive

•    aria-atomic

•    aria-relevant

example: faked button with notification using aria-live and aria-atomic

some role s have implicit live region - e.g. role="alert"

unfortunately, support is...flaky

Page 158: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Karl Groves - jQuery Live Regions

Page 159: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

drag & drop

Page 160: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Dev.Opera - Gez Lemon - Accessible Drag and Drop Using WAI-ARIA

Page 161: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

•    aria-grabbed

•    aria-dropeffect

example: Open Ajax Alliance - Drag and Drop / Gez Lemon's Drag andDrop example

support is still bad (particularly on mobile) - consider refactoring orproviding alternative instead

Page 162: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

what about role="application" ?

Page 163: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

document vs application mode

assistive technologies/screenreaders generally operate in two modes:document mode and application mode (terminology varies)

•   in document mode ("reading mode"), user can navigate freely throughthe page/content with keyboard shortcuts provided by AT

•   in application mode ("forms mode"), keystrokes are mostly passeddirectly to page, which needs to handle all interactions

SSB Bart Group - How Windows Screen Readers Work on the Web

Page 164: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

role="application"forces application mode

Page 165: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

the result

•   all keystrokes can now be handled via JavaScript

•   need to ensure any text/content is explicitly associated withfocusable elements, use live regions, etc

•   any content areas should be given role="document" to re-enableuser control

Page 166: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015
Page 167: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

(Google Mail doesn't use role="application" ... for illustrative purposes only)

Page 168: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

you don't need role="application" ...

•   for native HTML elements ( <button> , <select> etc)

•   for common complex ARIA widgets (treeview, slider, dialog, etc)

in both cases, assistive technologies recognise them andautomatically switch to applicable mode / pass relevant keystrokes tothe page

tl;dr: in most situations, you won't need role="application"

Page 169: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

use role="application" withcaution/sparingly

(generally not to entire page)

Page 170: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

use role="document" to thendenote content areas

Page 171: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Marco Zehe - If you use the WAI-ARIA role “application”, please do sowisely!

Page 172: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA to explicitly definerelationships

beyond what HTML offers natively

Page 173: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

example: form enhancement using aria-describedby (plus aria-required and aria-invalid )

Page 174: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

example: form enhancement using aria-labelledby

Page 175: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

ARIA for remediation

Page 176: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

if your page/app uses inappropriate markup, ARIA can be used topatch some of the issues (if it can't be fixed properly)...

<table role="presentation" > <tr> <td>Layout column 1</td> <td>Layout column 2</td> </tr></table>

example: layout table remediation

Page 177: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

web components, angular, etc?

Page 179: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

Addy Osmani / Alice Boxhall - Accessible Web Components

Page 180: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

W3C Editor's Draft - Custom Elements - 11.1 Custom Tag example

Page 181: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

AngularJS Developer Guide - Accessibility with ngAria

Page 182: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

recap...

Page 183: WAI-ARIA - an introduction to accessible rich internet applications (1 day workshop) / Darmstadt / 22 January 2015

get in touch@patrick_h_lauke

github.com/patrickhlauke/ariapatrickhlauke.github.io/aria/presentation/

slideshare.net/reduxpaciellogroup.com

splintered.co.uk