Web Accessibility Cheat Sheet

Checklist of things to consider to improve the accessibility of your website

Monday, December 27, 2021

accessible

Table of Contents

TL;DR

Use Lighthouse to check your website's accessibility. You will see the same exact information in the Accessibility report.

Introduction

Accessibility is the practice of making your websites usable by as many people as possible. We traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups such as those using mobile devices, or those with slow network connections.


You might also think of accessibility as treating everyone the same, and giving them equal opportunities, no matter what their ability or circumstances. Just as it is wrong to exclude someone from a physical building because they are in a wheelchair (modern public buildings generally have wheelchair ramps or elevators), it is also not right to exclude someone from a website because they have a visual impairment. We are all different, but we are all human, and therefore have the same human rights.


To learn more, check this page where I copy pasted the content above.


ARIA (Accessible Rich Internet Applications)

Accessible Rich Internet Applications (ARIA) is a set of attributes that define ways to make web content and web applications (especially those developed with JavaScript) more accessible to people with disabilities.


It supplements HTML so that interactions and widgets commonly used in applications can be passed to assistive technologies when there is not otherwise a mechanism. For example, ARIA enables accessible navigation landmarks in HTML4, JavaScript widgets, form hints and error messages, live content updates, and more.

Warning: Many of these widgets were later incorporated into HTML5, and developers should prefer using the correct semantic HTML element over using ARIA, if such an element exists. For instance, native elements have built-in keyboard accessibility, roles and states. However, if you choose to use ARIA, you are responsible for mimicking (the equivalent) browser behavior in script.

Here are some accessibility guidelines related to ARIA:

Each ARIA role supports a specific subset of aria-* attributes. Mismatching these invalidates the aria-* attributes.

Learn more


Assistive technologies, like screen readers, work inconsistently when aria-hidden="true" is set on the document <body>.

Learn more

When an element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.

Learn more


When an element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.

Learn more


Focusable descendents within an [aria-hidden="true"] element prevent those interactive elements from being available to users of assistive technologies like screen readers.

Learn more


Some ARIA roles have required attributes that describe the state of the element to screen readers.

Learn more


ARIA roles must have valid values in order to perform their intended accessibility functions.

Learn more


Assistive technologies, like screen readers, can't interpret ARIA attributes with invalid values.

Learn more


Assistive technologies, like screen readers, can't interpret ARIA attributes with invalid names.

Learn more


Some ARIA parent roles must contain specific child roles to perform their intended accessibility functions.

Learn more


Some ARIA child roles must be contained by specific parent roles to properly perform their intended accessibility functions.

Learn more


When a toggle field doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.

Learn more


Custom interactive controls have appropriate ARIA roles.

Learn more


The value of an ARIA ID must be unique to prevent other instances from being overlooked by assistive technologies.

Learn more


Custom interactive controls have associated labels, provided by aria-label or aria-labelledby.

Learn more


Navigation

Navigation is the way users find and traverse the different pages available on your site. For this reason, it is imperative that navigation is accessible. By their nature, links are tab-able and all keyboard users and screen readers will read them–so, if your navigation is coded with links, a screen reader should find them.


Here are some accessibility guidelines related to navigation:

Landmark elements (<main>, <nav>, etc.) are used to improve the keyboard navigation of the page for assistive technology.

Learn more

Adding ways to bypass repetitive content lets keyboard users navigate the page more efficiently.

Learn more


Access keys let users quickly focus a part of the page. For proper navigation, each access key must be unique.

Learn more


DOM order matches the visual order, improving navigation for assistive technology.

Learn more


Tabbing through the page follows the visual layout. Users cannot focus elements that are offscreen.

Learn more


A value greater than 0 implies an explicit navigation ordering. Although technically valid, this often creates frustrating experiences for users who rely on assistive technologies.

Learn more


Custom interactive controls are keyboard focusable and display a focus indicator.

Learn more


If new content, such as a dialog, is added to the page, the user's focus is directed to it.

Learn more


A user can tab into and out of any control or region without accidentally trapping their focus.

Learn more


When a button doesn't have an accessible name, screen readers announce it as "button", making it unusable for users who rely on screen readers.

Learn more


Semantic structure

Structural, semantic HTML is the key starting point toward good accessibility practices. When a screen reader, or any sort of assistive device scans a web page, it gets information about the Document Object Model (DOM), or the HTML structure of the page. No styles or JavaScript will be read by a screen reader.

Here are some accessibility guidelines related to semantic structure:

Properly ordered headings that do not skip levels convey the semantic structure of the page, making it easier to navigate and understand when using assistive technologies.

Learn more


Screen readers have a specific way of announcing lists. Ensuring proper list structure aids screen reader output.

Learn more


Screen readers require list items (<li>) to be contained within a parent <ul> or <ol> to be announced properly. Learn more.

Learn more


When definition lists are not properly marked up, screen readers may produce confusing or inaccurate output.

Learn more


Definition list items (<dt> and <dd>) must be wrapped in a parent <dl> element to ensure that screen readers can properly announce them.

Learn more


Screen readers have features to make navigating tables easier. Ensuring <td> cells using the [headers] attribute only refer to other cells in the same table may improve the experience for screen reader users.

Learn more


Screen readers have features to make navigating tables easier. Ensuring table headers always refer to some set of cells may improve the experience for screen reader users.

Learn more


Visual

Here are some accessibility guidelines related to visual consideration:

Low-contrast text is difficult or impossible for many users to read.

Learn more


Disabling zooming is problematic for users with low vision who rely on screen magnification to properly see the contents of a web page.

Learn more


Language

Here are some accessibility guidelines related to language:

Specifying a valid BCP 47 language helps screen readers announce text properly.

Learn more


If a page doesn't specify a lang attribute, a screen reader assumes that the page is in the default language that the user chose when setting up the screen reader. If the page isn't actually in the default language, then the screen reader might not announce the page's text correctly.

Learn more


Specifying a valid BCP 47 language on elements helps ensure that text is pronounced correctly by a screen reader.

Learn more


Forms

Forms are constantly being used to collect information from users: signing up for something, buying something, asking a question, or contacting someone. Since forms are so commonly used, it is imperative to make forms accessible for all users.

Here are some accessibility guidelines related to forms:

Form fields with multiple labels can be confusingly announced by assistive technologies like screen readers which use either the first, the last, or all of the labels.

Learn more


Labels ensure that form controls are announced properly by assistive technologies, like screen readers.

Learn more


Alternate Text

Alternative text is a textual substitute for non-text content in web pages.

Alternative text serves several functions:

Here are some accessibility guidelines related to alternate text:

Informative elements should aim for short, descriptive alternate text. Decorative elements can be ignored with an empty alt attribute.

Learn more


When an image is being used as an <input> button, providing alternative text can help screen reader users understand the purpose of the button.

Learn more


Screen readers cannot translate non-text content. Adding alt text to <object> elements helps screen readers convey meaning to users.

Learn more


Link text (and alternate text for images, when used as links) that is discernible, unique, and focusable improves the navigation experience for screen reader users.

Learn more


Other accessibility considerations

The title gives screen reader users an overview of the page, and search engine users rely on it heavily to determine if a page is relevant to their search.

Learn more


Users do not expect a page to refresh automatically, and doing so will move focus back to the top of the page. This may create a frustrating or confusing experience.

Learn more


All focusable elements must have a unique id to ensure that they're visible to assistive technologies.

Learn more


Screen reader users rely on frame titles to describe the contents of frames.

Learn more


When a video provides a caption it is easier for deaf and hearing impaired users to access its information.

Learn more


Interactive elements, such as links and buttons, should indicate their state and be distinguishable from non-interactive elements.

Learn more


Offscreen content is hidden with display: none or aria-hidden=true.

Learn more


What's next (More copy-pasting)