Introduction
What is Accessibility?

Accessibility (sometimes stylized as A11y) is the practice of making your websites able to be easily used by as many people as possible regardless of their physical and cognitive abilities or how they access the web. A quick rundown of the qualities of an accessible website are as follows:

Why You Should Care

Traditionally accessiblity is associated with a focus on helping people with disabilities, such as those who are blind or hard of hearing, which is plain and simple the right thing to do. Beyond that, however, the practice of making sites accessible actually benefits everyone:

Disabilities to Consider

According to the World Health Organization, about 15% of the total world population has some form of disability. A key part of accessible design is thinking beyond how you access the web and considering how your end users will interact with what you create. The main types of disability to consider are explained below, along with any types of assistive technologies (abbreviated as ATs) that they use to access web content.

Visual Impairments

People with visual impairments include those with blindness, low-level vision, and color blindness. They often use the following ATs to access the web:

Hearing Impairments

People with hearing impairments include those with auditory impairments or deaf people, which means they have either low hearing levels or no hearing at all. While people with hearing impairments do use ATs, there are none designed specifically designed for computer use. However, you can utilize specific techniques such as Closed Captioning or text transcripts to make any audio and video content more accessible to them.

Mobility Impairments

People with mobility impairments include those who have disabilities concerning movement. They might be purely physical issues (paralysis or loss of limb), might be a weakness or loss of control in limbs caused by neurological or genetic disorders, or may simply be less dexterous as a result of old age. The primary way you can accomodate these users is by improving keyboard navigation and allowing the page UI to be manipulated via keyboard input.

Cognitive Impairments

People with cognitive impairments covers a very wide range of end users. Examples include those with intellectual disabilities, those with learning disabilities, those with mental illnesses, and senior citizens facing challenges due to old age. Struggles they commonly face include difficulty with understanding content, trouble remembering how to complete tasks, and confusion caused by inconsistent page layouts.

The best way to accomodate these users are as follows:

Semantic HTML

Semantic Hypertext Markup Language (HTML) means using HTML elements for their intended purpose as much as possible. Non-semantic elements, such as <div> and <span>, are elements that tell you nothing about their content by the tag alone. Semantic elements are elements such as <main> and <nav> that clearly indicate their purpose via their tag name. While you can use CSS and Javascript to make any element behave like another (such as making a link act like a button), this often doesn't result in the most accessible websites.

Examples of Good Semantics: Examples of Bad Semantics:

HTML is accessible by default when used correctly, so web developers should strive to follow good semantics as much as possible.

CSS & JavaScript

CSS and JavaScript are able to help or damage accessibility depending on how they are used. When both are used properly in conjunction Semantic HTML, they can enhance the accessibility of your website.

CSS

Cascading Style Sheets (CSS) are very powerful as they are the backbone of visual design on the web; if the HTML is bones of the house, CSS is the wallpaper and the furniture. With CSS it's possible to make any HTML element look like another, which can either hurt or help your accessibility. Examples of Good Practices for CSS include:

Here is one of my favorite examples of CSS being utilized to its fullest to increase accessibility. The following code is from Bootstrap, and is very helpful when designing with screen readers in mind:

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

Items with the class .sr-only are hidden off screen, and their contents will only ever be read out loud by screen readers. This is great for adding alternative text and labels for users of screen readers that you don't want visible in any way, shape, or form to other users.

Javascript

Javascript is an incredibly powerful language that allows for the creation of robust apps. While not everything made with Javascript can be made accessible to 100% of users, it is good to strive towards making your web content (especially simple web pages) as accessible as possible.

The key to accessible Javascript comes in knowing how much Javascript is enough. Ask yourself: do you really need to use a framework for a simple one-page website? Thinking like this is called designing with unobtrusive JavaScript in mind, which conveys the idea that Javascript should be used to enhance basic functionality, not create it. Using Javascript to enhance the user's experience with things like form validation or custom keyboard-accessible controls for <video> or <audio> elements when browsers don't provide the functionality by default are great options for using Javascript in an accessible way.

WAI-ARIA

WAI-ARIA stands for Web Accessibility Initiative - Accessible Rich Internet Applications, and is a specification written by the World Wide Web Consortium (W3C). It defines additional HTML attributes that can be applied to elements in order to improve accessibility by providing additional descriptive labels. WAI-ARIA attributes don't affect the way webpages look; the only thing they affect is the information exposed by the browser's accessibility APIs, which is what screen readers use to read text.

Main Features: When to Use:

This page is even using WAI-ARIA attributes! The headers are not traditional heading tags due to project requirements, so accessibility is added by giving them the role="heading" attribute and specifying the heading level with the aria-level attribute. All decorative icons on this page are also using the aria-hidden="true" attribute, which is used to hide elements from screen readers that are unable or unecessary to be read by screen readers.

For further reading, you can learn WAI-ARIA basics on the MDN Web Docs or read the WAI-ARIA docs in full. You can also read about WAI-ARIA browser compatibility on "Can I Use", and about WAI-ARIA screenreader support on this WAI-ARIA Screen reader compatibility article by Powermapper.

Web Content Accessibility Guidelines (WCAG)

The Web Content Accessibility Guidelines (WCAG) were developed through the W3C process in cooperation with individuals and organizations around the world. The goal of the WCAG is providing a single shared standard for web content accessibility that is able to meet the needs of individuals, organizations, and governments across the globe. The WCAG is divided into four main categories which specify how you can implement content in ways that are perceivable, operable, understandable, and robust.

The best way to start learning about the WCAG is via the WCAG at a Glance page on the WCAG website. It is not necessary to memorize the WCAG, but it's good to keep it in mind and use it as a reference when designing with accessibility in mind.

Reference