51
Raj Lal Senior Engineer Developing Websites for Everyone Accessible Design with HTML5

Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

  • Upload
    raj-lal

  • View
    9.451

  • Download
    0

Embed Size (px)

DESCRIPTION

Learn how to design an HTML5 application which supports people with disabilities, and know why its a good business decision. An accessible web application gives maximum reach to your application's information, functionalities and benefits, by allowing multiple input methods, different interaction models, and customization based on special needs and limited device supports. The four major disabilities that effect user capabilities are visual, hearing, mobility (difficulty in using the mouse), and cognitive disabilities, which are related to learning abilities. Know how to use the latest technologies to accommodate these users in the user interface.

Citation preview

Page 1: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Raj LalSenior Engineer

Developing Websites for Everyone

Accessible Design with HTML5

Page 2: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Agenda

About Accessibility

Business Case

4 Key Areas 7 Steps in HTML5

Page 3: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

About Accessibility

Page 4: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

About Accessibility

Accessibility is about making web pages Easier to Use

Page 5: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Easier to Access

For Everyone

Latest Technology Available

About Accessibility

Page 6: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Easier to Access• Screen readers

• Audio browsers

• Only keyboard or mouse

• Limited bandwidth

• Old browsers, computers

• Mobile / touch devices

Page 7: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

For Everyone

Disabled

Seniors Citizens

Low literacy level

Temporary illness

Advanced Users

Page 8: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Latest Technology Available

HTML5 CSS3 JavaScript

Page 9: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

The Business Case

Page 10: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

The Business Case

Search Engine Optimization

Higher Search Engine Ranking

Senior Citizens spend 2x time buying online

Affluent customers may not be tech savvy

Its also a Law (section 508)

Page 11: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

4 Key Areas

Page 12: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

4 Key Areas

Hearing

Mobility

Cognitive

Visual

Page 13: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

1/4 Hearing

Problem

Cannot hear media

Solution

Make it PERCEIVABLE

Page 14: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

PERCEIVABLE

Text alternative to all non-text content Alternative for media using subtitles

Transcribed text and Sign language

1/4 Hearing

Page 15: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

2/4 Mobility

Problem

Difficulty with Mouse, Keyboard

Solution

Make it OPERABLE

Page 16: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

2/4 Mobility

OPERABLE

All function accessible from keyboard alone

No auto refresh, allow stop time based contents

Navigate with proper use of Headings & Anchors

Joysticks, Voice recognition or audio feedback

Page 17: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

3/4 Cognitive

Problem

Difficulty with Text content

Solution

Make it UNDERSTANDABLE

Page 18: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

3/4 Cognitive

UNDERSTANDABLE

High color contrast 4.5:1

Use San serif fonts & allow resize

Avoid auto-play of media, animation

Avoid auto refresh, or flashy graphics

Use multiple visual cues, std. icons & audio feedback

Page 19: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

4/4 Visual

Problem

Cannot see the content or color

Solution

Make it ROBUST

Page 20: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

4/4 Visual

ROBUST

Broken HTML tag can cause difficulty in screen reader

Follow HTML standard specifications

Use syntactically correct HTML & validate web page

Proper “lang” attributes in the markup

Use “acronym” and “abbr” tag with proper usage

Page 21: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Perceivable

W3C’s The POUR Principle

Operable Understandable

Robust

Page 22: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

7 Steps in HTML5

Page 23: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 1: Make Progressive Enhancements

Page 24: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 1: Progressive Enhancement

HTML HTML CSS

HTML CSS JavaScript

Page 25: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 1: Progressive Enhancement

Design in a Progressive enhancement way

All content available by HTML alone

Use semantically structured HTML

All presentation elements in the style sheet

Page 26: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 1: Example

<h1>Top Level Heading</h1> <section> <h1>Second Level Heading</h1> <p>An <strong>important</strong> text in <em>section</em> element </p> </section>

Page 27: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 1: Comparison

<div class="depth0"> <a href="#" name="d26"> <img id="vh_div16indic" src="pix/closed.gif" alt="Closed"> Security </a></div><span id="vh_div16"></span>

Bad Example

<li class="closed"><a href="#">Security</a></li>

Good example

Page 28: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 1: Comparison

<font size=”14px” color=”#000”><b>Welcome to the site</b></font><td style="width:180px" id="left-column">…

Bad Example

<style type="text/css"><!-- td#left-column {width: 180px;} --></style><h1>Welcome to the site</h1><table><tr><td id="left-column">…

Good example

Page 29: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 2: Allow Content Navigation

Page 30: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 2: Allow content navigation

Accessible navigation sidebar

Option to skip to main content

Menus accessible from keyboard

Proper nesting of headings, h1, h2, h3, etc.

Page 31: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 2: Layout

HTML5OLD

Page 32: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 2: Layout with Role

<header role="banner"><nav role="navigation"><section role=“main”><footer role=“toolbar”><footer role=“button”>…

HTML5 Accessible HTML5

Page 33: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 3: Makes FORMS Accessible

Page 34: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 3: Make Forms Accessible

Use ‘label” tag for describing form elements

Associate labels with controls using "for" attribute

Create a logical tab order with “tabindex”

For tabbed interface use aria-hidden and aria-pressed

Use “fieldset” and “legend” to group form elements

Use aria-live=“assertive” in the form for validation

Page 35: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 3: HTML code

<ul class="group">

<li><input type="radio" id="EHTML" value="html" checked> <label for="EHTML">HTML</label></li>

<li><input type="radio" id="ETEXT" value="text" > <label for="ETEXT">Text</label></li>

</ul>

Good example

Page 36: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 3: HTML code

<fieldset> <legend tabindex="10"><b>Personal Details</b> </legend> <label for="name">Name:</label> <input id="name" type="text" size="30" tabindex="11"> <br> <label for="id">ID Number:</label> <input id="id" type="text" size="10" tabindex="12"> </fieldset>

Good example

Page 37: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 4: Accessible Images

Page 38: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 4: Make Images Accessible

Use ”alt” attribute for alternative text for the image

Use “title” attribute for tooltip

Use role=“presentation” to ignore the image

Use blank ”alt” for decorative images

Use meaningful name for src=“meaningful.png”

Page 39: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 5: Accessible Media

Page 40: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 5: Make Media Accessible

Media player features navigable by keyboard

Closed captions with timed text files

Switchable sign translation video

Transcripts, caption and sign language

Page 41: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 6: Know HTML5 Animations

Page 42: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

SVG & JavaScriptCanvas & JavaScript

CSS3 Animation

Step 6: Know HTML5 Animations

Page 43: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 6: Know HTML5 Animations

Animation: SVG

• 2D vector graphics using XML• Object retained in the memory• Full DOM support• SVG elements can be styled• Check Modernizr.svg Modernizr.inlinesvg

Perform better when smaller number of elements and large surface

Page 44: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

<svg id="svgElement" width="800px" height="600px" viewBox="0 0 800 600">

<rect x="0" y="0" width="100%" height="100%" rx="10" ry="10" style="fill: white; stroke: black;" />

<circle id="circle0" cx="40" cy="40" r="40" style="fill: orange; stroke: black; stroke-width: 1;" /></svg>

HTML CODE

Page 45: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 6: Know HTML5 Animations Animation: Canvas: Context 2D

• Bitmap drawing area• Rectangles, lines, arcs, paths• Stateless • No DOM support, single element• Check Modernizr.canvas

Perform better when large number of objects and surface is small

Page 46: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 6: Know HTML5 Animations

Animation: CSS3

• Styles for Individual elements• Use CSS3 animation if available• Better than JavaScript based animation• Check Modernizr.csstransitions

Can perform better with GPU acceleration

Page 47: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 6: Know HTML5 Animations

#myelement{ …-ms-transition: opacity 1s ease;transition: opacity 1s ease;}

Animation: CSS3

var elem = $(‘myelement');

elem.addEventListener('click', function loop() { elem.style.left = ‘100px';}, false);

JS CODE

CSS

Page 48: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 7: Make Content Easy

Page 49: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 7: Make Content Easy

Font size should always be relative , never fixed

Links should be underlined and of different color

Use Anchor links, easily navigable by screen readers

Meaningful link text , avoid using “click here” or “more”

Page 50: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Step 7: Make Content Easy

Avoid long pages and minimize scrolling

Test navigation with Keyboard tab

Spelling help in Search

Color in CSS with foreground & background color

Simple and Machine (Screen reader) readable words like “Home page”

Page 51: Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 @iRajLal

Thank YouRaj Lal

Twitter @ iRajLal