Bård Hovde
Front-End developer at cddnation
The basics
Web accessibility refers to the inclusive practice of removing barriers that prevent access to websites by people with disabilities.
Quick introduction
WAI = Web Accessibility Initiative
ARIA = Accessible Rich Internet Applications.
WAI-ARIA is a spec defining support for accessible web apps.
Defines bunch of markup extensions, which can be used by the web app developer to provide additional information about the semantics of the various elements for screen readers.
<div role="toolbar">
Write good markup and use the right types of elements and you're already in a good place.
Native elements are already accessible!
BUT: If you create custom UI elements, you need to add custom attributes to make sure screen readers know what you've made.
If you can use a native HTML element or attribute with the semantics and behaviour you require already built in, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, then do so.
A few tips
Ensure that all content can be accessed with the keyboard alone.
Keyboard accessibility is one of the most important aspects of web accessibility. Many users with motor disabilities rely on a keyboard. In addition to traditional keyboards, some users may use modified keyboards or other hardware that mimics the functionality of a keyboard.
Un-plug/turn off your mouse.
Use the Tab key browse.
Use Enter to select elements.
Some menus and form elements may require ↑ ↓ ← → arrow keys.
Small things that don't take much work
Correct markup
<label for="field">Field:</label> <input id="field">
Mark Up Forms Semantically
<input id="field" aria-required="true">
Helper classes
<label for="field" class="visually-hidden">Enter Name:</label> <input id="field" placeholder="Enter Name">
.visually-hidden { position: absolute !important; clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ clip: rect(1px, 1px, 1px, 1px); padding:0 !important; border:0 !important; height: 1px !important; width: 1px !important; overflow: hidden; }
When you write markup, try to always arrange page contents from top to bottom.
This means the tabindex will be correct and won't need any tweaking.
tabindex="0"
When an element shouldn't be selectable or interacted with for some reason, use tabindex="0" to hide it.
role="dialog"
See if your custom UI is accessible. There's lots of quick wins here like adding roles to indicate functionality.
Things that can cause issues if not done right
Avoid outline:0 or similar styles on links and other elements that can receive keyboard focus.
Avoid non-descriptive links like this:
<a href="/">click here</a> to see nude photos of Tom Richards.
<a href="/">nude photos of Tom Richards</a> .
Better:
Web Accessibility Evaluation Tool (WAVE)
By Bård Hovde
The basics