On Github fuzzbomb / nwdug-a11y-2015-05-10
North West Drupal User Group10th May 2016
Senior developer at Annertech
Accessibility contributor at Drupal project
@MartianWebDev on Twitter.Fuzzbomb on GitHub, and most other places. We don't get to use cool handles on LinkedIn.
I love Drupal this much.
Photo of Andrew wearing a cheesy 1960s sci-fi space suit, made of neon pink and gold. His helmet is styled like the Drupal logo. The background is a photo-shopped outer-space landscape of mountains, planets and galaxies. One of the planets is the Drupal logo, a smiley face with an infinity symbol for eyes.
UK government statistics estimate 11.6 million peopleare living with some kind of disability in the UK.
Broad categories of impairments...
Disability isn't always clear-cut. It depends...
More than two-thirds of screen reader users surveyed said a lack of awareness (43%) or skills (26.6%) were the primary reason that developers do not create accessible web sites.
Source: WebAIM Screen reader User Survey #6 ResultsNot just "web" professionals...
... but feel free to ask about them later!
"POUR"
WCAG is organized as a set of success criteria, eachdescribing an accessibility practice in terms of:
Example: SC 1.3.1 Info and Relationships describes the use of headings and labels to indicate the structure of a page.
Grey text, on a grey background, is hard to read.
Who benefits? Users who...
Beware: large text is described in points, not pixels.Text size varies with screen size!
Many to choose from.
"Please correct the errors shown in red."
Monochrome photo of a snooker table, cue ball in the foreground, other balls near a corner pocket in the background.
"Steve is going for the pink ball - and for those of you who arewatching in black and white, the pink is next to the green."Ted Lowe (1920-2011)A person with protanopia has difficultyperceiving the red component of colours.
Let's look at some text where some linksinside a paragraph are styled red...
Solution? Underline the links!
This allows links to stand out, without relying on colour alone.
Most web browsers do this by default.
But your stylesheet killed it.
Everything that can be controlled with a mouse,must also be operable with a keyboard.
Just a few standard controls.
Not necessarily using assistive-technology.Might be a plain-old QWERTY keyboard.
The highlighted keys are used to interact with a web page.
Sighted keyboard users really need to be sure whatelement has focus, before they press enter.
Subtle focus styles don't work - they need to be clear.Beware of re-using mouse hover styles.
This doesn't limit your creativity - take inspiration from games consoles and Smart TV.
a { outline: none; }
(Unless you replace it with something even clearer)
Example: Virgin Media TV menus.Focus indicated by colour, border, width, and arrow.
Source: Virgin Media TiVo teases new design ahead of rollout
Allows quick access to interact with the page's main content,without traversing lots of sidebar links, or a header menu.
Who benefits? Primarily sighted keyboard users.(Screen readers offer other ways to get around a page.)
HTML is a great language for marking up documents.
HTML is not a general-purpose user-interface language, so developers often customize behaviour with javascript.Be careful what elements you use!
Button vs. Link. We'll run into that a lot.
Some attributes often contain rich semantics, but arereally only useful to a human audience: developers!
None are understood by screen readers.
<div class="button"> is not a button.Use <button> instead.
Assistive technology can understand these.
Watch out! In Drupal Form API the following code:
'#type' => 'button'... actually produces...
<input type="submit">
If you want a <button> use
'#type' => 'markup'Whoah. Learning curve.
Many ways to navigate or inspect a page...
NVDA screen reader provides a tool for landmarks and headings.
See the WebAIM Screenreader user survey
It reads the accessibility tree - huh?
Let's look at a Drupal 8 website!
Note: Drupal 8 is a nice screen reader experience ;-)
Myth: Good HTML is all that matters.
CSS affects accessibility in many ways.
CSS can hide content from assistive tech:
Both of these will hide content from screen readers, andinteractive elements will not be focusable by keyboard users.
Many frameworks provide a .visually-hidden class to hide labels and headings from the visual design, while making them available to screen readers. A useful way to maintain a good document outline.
Conversely, some methods of hiding contentvisually do not hide it from screen readers.
form .error-message { opacity: 0; }
An error message concealed in this way would be announcedby a screen reader, whether there is an error or not!
Content rendered outside the viewport is still there!This can be a help or a hindrance...
Good:"Invisible" labels are still accessible to screen readers.
Bad:Focusable elements are still in the tabbing order. Sighted keyboard users can traverse them, but can't tell what's in focus! Operable, but not perceivable. Example: a menu which slides on/off the page.
Myth: Accessible sites can't use Javascript.
It's a similar story: JS can help or hinder accessibility.
Javascript can change CSS properties and HTML attributes,or even replace whole chunks of HTML in the DOM...and a screen reader user might be none the wiser.
Used with care, Javascript can greatly enhance accessibility.
It's time to learn about ARIA.
HTML is NOT a general-purpose user interface language!
ARIA (accessible rich internet applications) providesa vocabulary of UI roles, states, and properties.
They express the range of interaction found in native desktop and mobile UI widget APIs, using formal, machine-readable semantics.
It's a game changer.
A "burger" style menu button. The aria-expanded property is toggled by Javascript during toggleMenuList().
<nav role="navigation" aria-labelledby="menuButton"> <h3> <button id="menuButton" onclick="toggleMenuList()" aria-controls="menuList" aria-expanded="true" >Menu</button> </h3> <ul id="menuList"> <li>Link 1</li> <li>Link 2</li> <li>Link 3</li> </ul> </nav>
For more detail, see my other slideshow from LeedsJS.
aria-describedby can associate help and/or error messages with a particular form input. Note that it can take multiple element IDs.
<label for="length">How long is a piece of string?</label> <input id="length" type="number" value="-10" aria-describedby="length-help length-error" aria-invalid="true" /> <div id="length-error">Error - length cannot be negative.</div> <div id="length-help">Measured in inches.</div>
A screenreader can announce"How long is a piece of string? Minus 10, number input, invalid. Measured in inches. Error - length cannot be negative."
Use it sparingly!
Do NOT use an aria-* role or property,if an equivalent one already exists in HTML.Host-language semantics are preferred.Avoid initialising dynamic properties in HTML source.Handle these with non-intrusive JavaScript.
ARIA is best used to supplement HTML semantics, but beware:ARIA will also override HTML semantics.
Example: this is a BUTTON, not a heading...
<h3 role="button">Options</h3>
For a collapsible section, where both heading and buttonsemantics are desired, use a button inside a heading.
<h3><button>Options</button></h3>
These help assistive tech users get to the right part of the page quickly, e.g. <div role=navigation>
ARIA roles: main, banner, contentinfo, navigation,complementary, search, ...
New HTML5 elements offer equivalents: main, header, footer, nav, aside.
Caution: Internet Explorer still needs roles, because the HTML semantics are not passed up through accessibility API.i.e. <nav role="navigation">
In fact, you might do better perusing their resource lists ;-)
A short open-source book which gives a great introduction to thinking about accessibility, along with techiniques.
Particularly useful for introducing personas when considering accessibility. For every technique, it has a discussion of who benefits, and how.
It's starting to look a little dated (19-inch is a large monitor!), and a few techniques have changed, but few books match this one as an introduction to the topic.
The End