fowd 14.09.2009

70
Keyboard accessibility Patrick H. Lauke / Future of Web Design Tour / Glasgow / 14 September 2009 BASIC STEPS TOWARDS A MORE USABLE AND ACCESSIBLE SITE

Upload: patrick-lauke

Post on 02-Jul-2015

445 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Fowd 14.09.2009

Keyboard accessibility

Patrick H. Lauke / Future of Web Design Tour / Glasgow / 14 September 2009

BASIC STEPS TOWARDS A MORE USABLE AND ACCESSIBLE SITE

Page 2: Fowd 14.09.2009

accessibility = blind users + screenreaders?

Page 3: Fowd 14.09.2009

difficult to test – need to install and learn screenreader

Page 4: Fowd 14.09.2009

many different forms of disability

Page 5: Fowd 14.09.2009

keyboard or keyboard-like interfaces

Page 6: Fowd 14.09.2009

easiest to test…no special software required

Page 7: Fowd 14.09.2009
Page 8: Fowd 14.09.2009
Page 9: Fowd 14.09.2009

by default users TAB

Page 10: Fowd 14.09.2009
Page 11: Fowd 14.09.2009

using keyboard, move from one focusable element to the next

Page 12: Fowd 14.09.2009

standard focusable elements: links, form elements, image map areas

Page 13: Fowd 14.09.2009
Page 14: Fowd 14.09.2009
Page 15: Fowd 14.09.2009
Page 16: Fowd 14.09.2009
Page 17: Fowd 14.09.2009
Page 18: Fowd 14.09.2009

don’t forget the fancy styling

Page 19: Fowd 14.09.2009
Page 20: Fowd 14.09.2009

a.action:hover { background-color:#a82310; color:#fff !important; text-decoration:none; } #promo-dvd .content a:hover img { background-color:#d5c7ae; }

Page 21: Fowd 14.09.2009

a:focus, a:hover, a:active { … }

Page 22: Fowd 14.09.2009

don’t suppress outline!

Page 23: Fowd 14.09.2009
Page 24: Fowd 14.09.2009

keyboard accessible, but where am I?

Page 25: Fowd 14.09.2009

/* =Reset Styles - Thank you Eric Meyer (http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/) */

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5,

h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {

margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } :focus { outline: 0; }

Page 26: Fowd 14.09.2009

/* remember to define focus styles! */

Page 27: Fowd 14.09.2009

why do designers suppress outline?

Page 28: Fowd 14.09.2009
Page 29: Fowd 14.09.2009

“get your outline out of my design!” …is there a compromise?

Page 30: Fowd 14.09.2009
Page 31: Fowd 14.09.2009
Page 32: Fowd 14.09.2009

a { … overflow: hidden; }

Page 33: Fowd 14.09.2009
Page 34: Fowd 14.09.2009

…only suppress it on :active

Page 35: Fowd 14.09.2009

TAB cycle – normally just source order

Page 36: Fowd 14.09.2009

tabindex forces a certain TAB cycle

Page 37: Fowd 14.09.2009

anything with tabindex takes precedence

Page 38: Fowd 14.09.2009
Page 39: Fowd 14.09.2009

<input type="text" name="author"…tabindex="1" /> <input type="text" name="email"…tabindex="2" /> <input type="text" name="url"…tabindex="3" /> <textarea name="comment"…tabindex="4"></textarea>

Page 40: Fowd 14.09.2009

easy enough…let’s drop in some JavaScript

Page 41: Fowd 14.09.2009
Page 42: Fowd 14.09.2009
Page 43: Fowd 14.09.2009

keyboard accessible, but where’s the extra information?

Page 44: Fowd 14.09.2009

$('#whatever').hover( function() {…}, function() {…} );

Page 45: Fowd 14.09.2009

$('#whatever').hover( function() {…}, function() {…} ); $('#whatever').focus(function() {…}); $('#whatever').blur(function() {…} );

Page 46: Fowd 14.09.2009

aside: mobile browsers don’t do hover (well)

Page 47: Fowd 14.09.2009

lightboxes…we love ’em

Page 48: Fowd 14.09.2009
Page 49: Fowd 14.09.2009

close it again on TAB don’t invent new keyboard shortcuts

Page 50: Fowd 14.09.2009

more complex solution: manage focus

Page 51: Fowd 14.09.2009

and now, the dangerous part…

Page 52: Fowd 14.09.2009

JavaScript attaches behaviour to anything

Page 53: Fowd 14.09.2009

$('div').click(function() {…} );

Page 54: Fowd 14.09.2009

sexy tutorials out there doing it wrong

Page 55: Fowd 14.09.2009
Page 56: Fowd 14.09.2009

be lazy…use libraries that solved this YUI, jQueryUI, etc

Page 57: Fowd 14.09.2009

beware 3rd party solutions even the big boys can get it wrong

Page 58: Fowd 14.09.2009
Page 59: Fowd 14.09.2009
Page 60: Fowd 14.09.2009
Page 61: Fowd 14.09.2009

hijack generated markup to accessify it

Page 62: Fowd 14.09.2009

in conclusion…

Page 63: Fowd 14.09.2009

if you style :hover, also :focus and :active

Page 64: Fowd 14.09.2009

don’t suppress outline completely (reintroduce :focus and suppress :active)

Page 65: Fowd 14.09.2009

leave tabindex alone – source order

Page 66: Fowd 14.09.2009

JavaScript on hover (mouseover/mouseout) also on focus/blur

(if focusable element)

Page 67: Fowd 14.09.2009

lightboxes and their problems

Page 68: Fowd 14.09.2009

only attach behaviour to focusable elements

Page 69: Fowd 14.09.2009

</rant>

Page 70: Fowd 14.09.2009

www.opera.com/developer [email protected]