Accessible UX

A presentation at Wordcamp Vienna in April 2017 in Vienna, Austria by Manuel Matuzovic

Slide 1

Slide 1

UX ACCESSIBLE Manuel Matuzovi ć

   @mmatuzo 

WordCamp Vienna 04/2017

Slide 2

Slide 2

#WCVIE @mmatuzo

Slide 3

Slide 3

Manuel Matuzovic

Slide 4

Slide 4

Manuel Matuzovi ć

Slide 5

Slide 5

č , ć , đ , d ž , š , ž , nj, lj q , w,

x

Slide 6

Slide 6

Accessibility The quality of being able to be reached or entered. as defined by the Oxford Dictionar y

Slide 7

Slide 7

Accessibility in web design means creating web pages that everyone can use, regardless of hardware, so ! ware, or any sensory or physical impairment. WordPress Codex – Accessibility

Slide 8

Slide 8

Accessibility The quality of being easily understood or appreciated . *as defined by the Oxford Dictionar y

Slide 9

Slide 9

č , ć , đ , d ž , š , ž , nj, lj q , w,

x

Slide 10

Slide 10

K eyboard layout s “A keyboard layout is any specific mechanical, visual, or functional arrangement of the keys, legends, or key-meaning associations (respectively) of a computer, typewriter, or other typographic keyboard.” Wikipedia

Slide 11

Slide 11

QWERTY

Slide 12

Slide 12

QWERTZ

Slide 13

Slide 13

AZERTY

Slide 14

Slide 14

JCUKEN

Slide 15

Slide 15

Demo: Keyboard controls

Slide 16

Slide 16

QWERTY QWERT Z

Slide 17

Slide 17

event.keyCode window . addEventListener ( 'keydown' ,

navigate );

function

navigate ( e ) {

...

if

( e . keyCode

===

68 ) {

moveLeftAndRight ( 1 );

}

if

( e . keyCode

===

90 ) {

shootMissile ();

}

}

Slide 18

Slide 18

QWERTY

Slide 19

Slide 19

AZERTY

Slide 20

Slide 20

UI Events API • Two new properties: key and code • event.key

  • printable character or a descriptive string , e.g. z • event.code
  • physical key, e.g. KeyY

• Reference keyboard in the specification

Slide 21

Slide 21

Reference keyboard

Slide 22

Slide 22

window . addEventListener ( 'keydown' ,

navigate );

function

navigate ( e ) {

...

if

( e . code

===

'KeyD' ) {

moveLeftAndRight ( 1 );

}

if

( e . code

===

'KeyY' ) {

shootMissile ();

}

}

event.keyCode

Slide 23

Slide 23

Browsersupport

Slide 24

Slide 24

T WEETABLE TAKE-AWAY The web is international and so are your users. Don’t assume that all users use the same input devices.

Slide 25

Slide 25

lang a & ribute

<!DOCTYPE html > <html

lang

"en"

<head> <title> Document </title> </head> <body> </body> </html>

Slide 26

Slide 26

lang-A & ribute impacts • Assistive Technology • Translation tools and browsers • Quote characters

• Date and n umber inputs • Search engines

• Hyphenation

Slide 27

Slide 27

<!DOCTYPE html > <html <?php

language_attributes ();

?>

class

"no-js no-svg"

<head> <?php wp_head (); ?> </head> <body> </body> </html> lang a & ribute in WordPress

Slide 28

Slide 28

T WEETABLE TAKE-AWAY Make sure to tell the browser the correct language in use. Everyone benefits from it.

Slide 29

Slide 29

Keyboard users

Slide 30

Slide 30

Issues • Missing or insu ffi cient focus style s • Off-screen content

• Bad semantics (e.g. bu $ on)

• Bad focus management (e.g. modal window)

Slide 31

Slide 31

Possible solutions • :focus styling  

• Se $ ing tabindex

• Knowing and using basic HTML • Manage focus

• T rap focus

Slide 32

Slide 32

:focus styling  

a : focus

{

color :

#FF00FF ;

}

Slide 33

Slide 33

Hiding content

[hidden]

{

display :

none ;

}

Slide 34

Slide 34

Se & ing tabindex

<h2

tabindex

"0"

A focusable heading

</h2>

Slide 35

Slide 35

Semantics ma & er

<!-- DON'T: --> <div

class

"btn"

I'm a div

</div> <div

class

"btn"

tabindex

"0"

I'm a div

</div> <div

class

"btn"

tabindex

"0"

role

"button"

I'm a div

</div> <!-- DO: --> <button> Just use button </button>

Slide 36

Slide 36

Remember last focus // Store the last focused element

let

lastFocusedElement

=

document . activeElement ;

// Set focus to the modal window modal . focus ();

// Close the window by clicking the close button

close . addEventListener ( 'click' ,

removeModal );

function

removeModal () {

// Remove the modal window if it's visible

modal . classList . remove ( 'is-visible' );

// Return focus to last focused element

lastFocusedElement . focus ();

}

Slide 37

Slide 37

Trap focus // If the current element in focus is the first focusable element within the modal window … if

( document . activeElement

===

firstTabStop ) {

e . preventDefault ();

// ...jump to the last focusable element

lastTabStop . focus ();

}

Slide 38

Slide 38

Who are we doing this for?

Slide 39

Slide 39

T WEETABLE TAKE-AWAY Assuming that everybody is able to see, hear, say, and touch all the time creates the potential to ignore a lot of users.

Slide 40

Slide 40

T WEETABLE TAKE-AWAY Make sure to test plugins and JS components for keyboard support before you use them .

Slide 41

Slide 41

The Document Outline (h1-h6) • Convey document structure • SEO • Navigation for screen readers

Slide 42

Slide 42

Navigation via headings

Slide 43

Slide 43

The HTML5 document outline is a myth

<!-- DON'T DO THAT: --> <h1> Heading </h1> <section> <h1> Heading </h1> <section> <h1> Heading </h1> </section> </section>

Slide 44

Slide 44

Use properly ranked h-elements

<!-- DO THAT: --> <h1> Heading </h1> <section> <h2> Heading </h2> <section> <h3> Heading </h3> </section> </section>

Slide 45

Slide 45

T WEETABLE TAKE-AWAY A sound document outline has a huge impact on users and third party so ( ware. Get it right!

Slide 46

Slide 46

Navigation via landmarks

<header

role

"banner"

</header> <section> <form

role

"search"

</form>
</section> <aside></aside> <footer

role

"contentinfo"

</footer>

Slide 47

Slide 47

T WEETABLE TAKE-AWAY Take enough time to think about your document structure and markup content correctly.

Slide 48

Slide 48

WordPress and a11y • Make WordPress Accessible 
 ( h $ ps://make.wordpress.org/accessibility/ )

• Accessibility Handbook 
 ( h $ ps://make.wordpress.org/accessibility/handbook/ )

• Accessibility Theme Review 
 ( h $ ps://make.wordpress.org/themes/handbook/review/accessibility/ )

• Useful Tools 
 ( h $ ps://make.wordpress.org/accessibility/useful-tools/ )

• WP Accessibility Plugin 
 ( h $ ps://wordpress.org/plugins/wp-accessibility/ )

Slide 49

Slide 49

T WEETABLE TAKE-AWAY Accessibility is something that concerns all of us, you and me, every day. What we create is useless if it isn’t accessible.

Slide 50

Slide 50

THANK YOU Manuel Matuzovi ć

   @mmatuzo 

medium.com /@matuzo codepen.io/matuzo

manuel@matuzo.at

Slide 51

Slide 51

Images • Slide4: Daniel Gerersdorfer www.gerersdorfer.net • Slide5: h $ ps://maps.google.com • Slide11: h $ ps://en.wikipedia.org/wiki/QWERTZ#/media/File:KB_Germany.svg

• Slide12: h $ ps://en.wikipedia.org/wiki/QWERTY#/media/File:KB_Intl_English_Mac_- Apple_Keyboard(MC184Z).svg

• Slide13: h $ ps://upload.wikimedia.org/wikipedia/commons/4/41/Belgian_pc_keyboard.svg

• Slide14: h $ ps://upload.wikimedia.org/wikipedia/commons/6/60/KB_Russian.svg

• Slide21: h $ ps://www.w3.org/TR/uievents-code/#code-value-tables

• Slide38: h $ ps://download.microso & .com/download/B/0/D/B0D4BF87-09CE-4417-8F28-D60703D672ED/ INCLUSIVE_TOOLKIT_MANUAL_FINAL.pdf