Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly...

69
Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Transcript of Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly...

Page 1: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Accessible Web Mapping AppsARIA, WCAG and 508 Compliance

Kelly Hutchins

Tao Zhang

Page 2: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

AgendaIntroductionSection 508 and WCAGKnowledge and Techniques

FocusSemantic HTMLWAI-ARIA and accessible components

DemoAutomated TestingResources

Page 3: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Diversity of UsersAbout 15% of world population lives with some form of disability1 Billion People

Page 4: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Forms of Disability

Page 5: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

VisualA broad range from no vision (total blindness) to limited or low

vision

Page 6: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

MotorUsers may prefer not to use a mouse, have RSI (Repetitive Strain

Injury), or physical paralysis and limited range of motion

Page 7: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

AuditoryUsers may be completely deaf or hard of hearing

Page 8: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

CognitiveA broad range including:

Learning disabilitiesReading disorders(dyslexia)Attention deficit disorders(ADHD and autism)

Far more users with cognitive disabilities than all the other types ofdisabilities combined

Page 9: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Benefits of AccessibilityAccessible interfaces is about good design and coding practiceGood accessibility is good user experienceAccessibility will enhance design, not destroy it

Page 10: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Section 508 and WCAG

Page 11: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Section 508The Rehabilitation Act of 1973Mandates that people with disabilities have same access to anduse of ICT (Information and Communication Technology)comparable to those without disabilitiesProducts procured by government agencies must pass Section508 requirementsRecent refresh incoporates WCAG 2.0 Level A and AA successcriteria

Published: Jan. 18, 2017Enforcement: Jan. 18, 2018

Page 12: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Overview of WCAG 2.0

Page 13: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Level of ConformanceLevel A: Sets a minimum level of accessibility and does notachieve broad accessibility for many situations.Level AA: Generally recommended for web-based information.Level AAA: W3C does not recommend be required as generalpolicy because it is not possible to satisfy all Level AAA SuccessCriteria for some content.

Page 14: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Knowledge and TechniquesFocusSemantic HTMLWAI-ARIA and accessible components

Page 15: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Focus

Page 16: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Focus IntroductionFocus: Which control on the screen currently receives input fromkeyboard.Focus ring: visual focus indicator, style depending on browserand page style.

Tab order: The order in which focus proceeds forward andbackward through interactive elements via Tab key.

Page 17: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Focusable elementsNative interactive HTML elements are focusable:

Text fields, Buttons, Links, Select lists ...(Normally) not focusable:

<p>, <div>, <span>, <h1> ...Only focus elements that keyboard users need to interact withScreen reader users have ways to read focusable and non-focusable elements. ( )demo

Page 18: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Tab order matters: Reading and navigation order, as determined by

DOM structure, should be logical and intuitive.

Be careful changing visual position of elements on screen usingCSSAvoid jumping around tab order

WCAG 1.3.2

Page 19: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Offscreen elementsExample: Prevent element from gaining focus when off screen

Only allow it to be focused when user can interact with it

Calcite drawer pattern

display:none;visibility:hidden; /* alternative */

display:block;visibility:visible; /* alternative */

Page 20: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Test focusTab through page to see tab order doesn't disappear or jump outof logical sequenceMake sure to hide offscreen contentRearrange elements' position in the DOM if necessary

Page 21: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Manage focustabindex="0": let natural DOM structure determine tab ordertabindex="-1": programmatically move focus (e.g., errormessage, menus, radio buttons, etc.)tabindex="5": anti-pattern

Page 22: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Focus management exampleCustomized menu

<menu-list><!-- After the user presses the down arrow key,focus the next available child --><menu-item tabindex="0">Map</menu-item>

<!-- call .focus() on this element --><menu-item tabindex="-1">Layer</menu-item>

<menu-item tabindex="-1">Scene</menu-item><menu-item tabindex="-1">Tool</menu-item><menu-item tabindex="-1">Data</menu-item></menu-list>

Example code

Page 23: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Keyboard trapsKeyboard focus should not be locked or trapped at one particularelement.Temporary keyboard trap is necessary for modal dialogs:

When modal is displayed: trap focus inside modal.When modal is closed: restore focus to previously focuseditem.DemoExample code

Page 24: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Semantic HTML

Page 25: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Accessibility treeBrowser's responsibility to expose accessibility tree to assistivetechnologies.

Page 26: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Microsoft Edge's accessibility tree view

Page 27: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Chrome Canary's accessibility tree view

Page 28: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Shows how website is interpreted by assistive technologies andhow accessible data are provided.

Page 29: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Assistive technologies simulate and relay user interactions likeclick and key press to accessibility tree.As developers, we need to:

Express the semantics of page correctly.Specify accessible names and descriptions.Make sure important elements have correct accessible roles,states, and properties.

Page 30: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Semantics in native HTMLMost HTML elements have implicit semantics (role and state).Native HTML elements work predictably across browsers

Take advantage of this!

Page 31: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

:

Role="link"Accessible name="Esri Homepage"State="focusable"

Example

<a href="http://www.esri.com">Esri Homepage</a>

Page 32: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

:

Role="checkbox"Accessible name="Working at Esri"State="focusable checked"

Example

<label><input type="checkbox" checked>Working at Esri</label>

Page 33: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

KeyboardNative interactive HTML elements receive keyboard focus:

<a>, <button>, <input>...Interactive elements have expected interactions:

Link: click, tap, or Enter keyButton: click, tap, Enter key, or Space keyInput: click, tap, or Enter key

Page 34: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Neutral semanticsSome HTML elements do not convey semantics (role or state):

<div>This is a block area</div><span>This is an inline area</span>

Page 35: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

If the element is interactive, we need to do extra work:

Make it focusable: tabindex="0"Receive keyboard events: Enter, SpaceName: explicit label (label) or implicit text (aria-label, aria-labelledby)RoleStates and properties

Page 36: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

WAI-ARIAWeb Accessibility Initiative – Accessible Rich Internet Applications

Page 37: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Why need ARIAUse Native HTML semantics whenever possibleCertain semantics and design patterns make it impossible to usenative HTML semantics.

Example: a pop-up menu, no standard HTML elementExample: a semantic characteristic "the user needs to knowabout this as soon as possible"

Page 38: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

What is WAI-ARIASpecification for increasing accessibility of custom elementsAllows developers to modify and augment accessibility tree fromstandard DOM

Page 39: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

ARIA doesn't augment any of the element's inherent behavior:

FocusableKeyboard event listeners

Custom behaviors still need to be implemented

Page 40: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

ARIA attributesType Purpose ExamplesRoles Meaning of an

elementtooltip, tablist, search

Properties Relationshipsand functions

aria-required, aria-controls, aria-label, aria-labelledby

States Currentinteractionstates

aria-checked, aria-expanded,aria-hidden

Page 41: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Sighted users see a checkbox as a result of CSSclass="checkbox".Screen reader users will not know this is meant to be acheckbox.

An ARIA example<li tabindex="0" class="checkbox" checked> Show premium content</li>

Page 42: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Screen reader will report this as a checkbox.

An ARIA example<li tabindex="0" class="checkbox" role="checkbox" checkedaria-checked="true"> Show premium content</li>

Page 43: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

RolesLandmarks

banner: The main header of a page; typically assigned to aheader element.contentinfo: A collection of metadata, copyright informationand the like.main: the main content of a document.navigation: A collection of links for navigation.

Demo

Page 44: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

RolesWidgets

alertdialogdata gridtabtablisttabpanel

Page 45: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Properties - Labelsaria-labelSpecifies a string as accessible labelOverrides native labeling

Page 46: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Properties - Labelsaria-labelledby

Specifies id of another DOM element (or a list of id)Overrides all other name sourcesApplicable to any element, not just labelable elementsCan specify visually hidden elements

Page 47: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Relationshipsaria-owns

Indicates an element should be treated as parent of anotherseparate DOM element

Page 48: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Relationshipsaria-describedby

Provides accessible description for an elementReferences elements in the DOM separated from currentelement

Page 49: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Relationshipsaria-controls

Indicates an element "controls" another element in interaction

<div role="scrollbar" aria-controls="main"></div><div id="main">. . .</div>

Page 50: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Hide elementsElements explicitly hidden from the DOM will not be included inaccessibility tree

[hidden] { display: none; /*not rendered, no space allocated */}[invisible] { visibility: hidden; /*rendered, space allocated*/}

Page 51: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Elements not visually rendered but not explicitly hidden is stillincluded in accessibility tree.

/* Screen reader only*/.sr-only { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden;}

Page 52: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

aria-hiddenExcludes content from assistive technology that is not visuallyhidden.Removes current element and all of its descendants from theaccessibility tree.Demo

Page 53: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Update elementsrole="alert"aria-live

Marks element as "live region" in which updates should becommunicated to users immediately.aria-live="polite": alert user when screen reader has finishedcurrent actionaria-live="assertive": interrupt current action and alert userimmediately

Page 54: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

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

Example: A developer wants to implement a heading which isalso a button.Don't do this:

Do this:

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

<h2><button>heading button</button></h2>

Page 55: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

2. All interactive ARIA elements must be usable with keyboard.

The elements should respond to standard key strokes.Example: If using role="button", add tabindex="0" and supportEnter and Space actions.

The user must be able to navigate and perform actions usingkeyboard.

Example: If allowing clicking through data grid, supportnavigating grid cells using keyboard.

Page 56: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

3. Do not use `role="presentation"` or `aria-hidden="true"` on avisible and focusable element.

This will result in focusing on "nothing".Don't do these:

<button role="presentation">Press me</button><button aria-hidden="true">Press me</button>

Page 57: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

4. All interactive elements must have an accessible label or name.

Do this:

<label> Email <input type="text" placeholder="[email protected]"></label>

Page 58: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Create Accessible Web Components

Page 60: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Accessible MapFor low-vision users:

Color contrastColor blindnessScaling and images of text

For non-sighted users:Alternative text for map's core informationAccessibility in Google Maps

Page 61: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Common Accessibility Issues:

Text alternativesSemantic HTMLTab order and focusColorLabel

Demo

Page 62: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

Automated Testing

Page 63: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

A11Y command-line tool

by Addy Osmani

npm install -g a11ya11y www.esri.com > audit.txt

Page 64: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

A11Y module usagea11y(URL, callback) accepts a string as input and takes a callbackproviding a reports object with the accessibility audit for thesupplied URL.

Page 65: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

var a11y = require('a11y');a11y('esri.com', function (err, reports) { var output = JSON.parse(reports); var audit = output.audit; //a11y formatted report var report = output.report; //Chrome devtools accessibility audit formatted report reports.audit.forEach(function (el) { // result will be PASS, FAIL or NA if (el.result === 'FAIL') { // el.heading // el.severity // el.elements } });});

Page 66: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

axe-coreAccessibility engine for automated Web UI testing by :dequelabs

npm install axe-core --save-dev

<script src="node_modules/axe-core/axe.min.js"></script><!-- Normal page content ... --><script> axe.run(function (err, results) { if (err) throw err; ok(results.violations.length === 0, 'Should be no accessibility issues'); // complete the async call });</script>

Page 67: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang

ResourcesDocumentation

Coursesegghead.io: Udacity:

Some of the diagrams are adapted from

W3C-WCAG 2.0Interpretation of success criteriaWAI-ARIA Authoring Practices 1.1

Start Building Accessible Web Applications TodayWeb Accessibility by Google

a11yaxe-coreaXe Chrome extensionChrome Accessibility Developer Tools

Google Developers:Web Fundamentals

Page 68: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang
Page 69: Accessible Web Mapping Apps · Accessible Web Mapping Apps ARIA, WCAG and 508 Compliance Kelly Hutchins Tao Zhang