Web accessibility standards and guidelines
How do we determine if an interface is available? And how accessible is it? Can it be made even more accessible? Of course, everyone understands quality in its own right, so standards and specifications come to the rescue.
Web Content Accessibility Guidelines (WCAG), a document describing a set of recommendations for developing accessible interfaces, have been developed for web accessibility. In 2012, version 2.0 of this document became the ISO standard.
The recommendations were grouped into 4 principles: perception, controllability, clarity, and reliability. And each recommendation has its own level – A, AA, AAA, which determines the accessibility of the interface. The greater the A, the better. A <AA <AAA. The interface is said to comply with WCAG 2.1 AA if it has implemented all AA-level recommendations.
How to make the web interface accessible
Today, the industry requires everyone to understand the basics of accessibility. In 2012, there was very little comprehensible and straightforward information about the A11y – mostly boring and sometimes abstract specifications. There are now plenty of articles, blogs, YouTube channels, and courses. One of the sources – A11y Casts, where the author talks about assistive technology and accessibility principles in a convenient format (up to 15 minutes); and Udacity and Google’s Web Accessibility course, which gives 80% of the basic understanding of accessibility.
Keyboard and focus
If you are working on a website or already have one, try using the keyboard interface only. From now on, Tab is your best friend. Also, try experimenting and testing how available web resources respond to Tab. For example, The New York Times – links to a page become active one by one with each click; An outline appears around the link, new elements such as the Skip to Content link, and you can generally scroll through the entire page simply by tapping Tab, jumping over all elements that can focus. You can go to the active link by pressing Enter. Convenient, isn’t it?
The good news is that browsers themselves can handle keystrokes, and we, as developers, should simply not interfere with them. Here are some tips on how to put your browser’s skills to the benefit of your users:
– Do not hide the outline. An outline is a gray (or blue in Chrome) outline that appears when you click on form elements or navigate from the keyboard. And it is so often not loved by designers. However, the outline itself is a lifeline when using the keyboard, as it plays the role of a cursor. There’s even a whole resource for why it’s bad to do – a {outline: none; }.
– Keep the order of the HTML tags according to the visual presentation of the page. Browsers and screensavers do not take into account the reordering of elements using CSS (order: n; in flexbox or float) when building accessibility tree, reading content and navigating the keyboard.
– If you still need to reposition the elements, use tab index, an HTML attribute that indicates the order of the elements when navigating the keyboard, adds or removes an element from the entire list of interactive elements on the page.
– Add a Skip Navigation link (see NYTimes.com example) to prevent users from scrolling through all the navigation to get to the content.
– Use focus traps when needed, for example, if you have a modal window on the page. The user can only move between the elements of this window, but he must be able to close this window using the keyboard.
– Avoid accidental and harmful focus traps – situations where the user is stuck between several elements and cannot return to the content. This often happens when a pop-up advertisement pops up on a page that cannot be closed from the keyboard.
If you are working to implement a UI pattern (modal window, accordion, etc.), check out the recommendations from the Design Patterns and Widgets section of WAI-ARIA Authoring Practices. There are dozens of patterns and, in particular, their correct behavior in response to keyboard commands. It is not necessary to invent a bicycle – there are already standards.
Semantics and content
In order to display the page, browsers parse HTML, CSS, JS, build DOM, CSSOM trees, as well as Accessibility tree. A11y Tree is a simplified structured view of a document that uses assistive technologies:
While building these trees, the browser ignores errors, specifications, and tries to guess what the author was referring to. And it works well with HTML, but it’s not an option for assistive technologies.
For example, let us have the following form:
- Written by: Recruiter
- Posted on: December 21, 2019
- Tags: basics, frontend, javascript