How to Test Accessibility, a Guide for Software Engineers
Tags: a11y, tutorial, frontend
Published: 2023-01-04 04:28:28

Over one billion people worldwide live with a disability that can affect access to the Web. This guide is a starting point for Software Engineers to make sure UI elements are accessible.

> “The power of the web is in its universality. Access by everyone regardless of disability is an essential aspect.” —Tim Berners-Lee, W3C Director and Inventor of the World Wide Web 

_______

## :open_book: Table of Contents
- :blue_book: Automated and Manual Testing
- :clapper: Take Action to Remediate Issues
- :white_check_mark: Accessibility Testing Checklist
- :question: Resources and Training
- :clipboard: Related articles

_______
 

### :blue_book: Automated and Manual Testing

After creating or updating a page or another frontend component, check your work by doing the following:

1. **Automated Audit**: Run an accessibility audit using at least one of the following tools:
  - Google Chrome’s Lighthouse
     - Video Tutorial (Skip to 1:22): [Google Lighthouse | Automated Accessibility Tool Review](https://www.youtube.com/watch?v=rvn2XCmNKXI&t=82s)
     - Blog: [Do an Accessibility Audit using Google Chrome LightHouse  ](https://medium.com/accessibility-a11y/do-an-accessibility-audit-using-google-chrome-lighthouse-30ff7887901c)
  - Accessible Web’s Extension
     - [Web Accessibility Extension | Accessible Web](https://accessibleweb.com/web-accessibility-checker-browser-extension/) 


2. **Sufficient Color Contrast Ratio**: Check if the color contrast ratio is accessible with one of the following tools:
  - Use the color contrast tool that is part of the Accessible Web extension
  - Copy the text and background colors into this handy tool, [Are My Colors Accessible](https://www.aremycolorsaccessible.com/), and play with the hue, saturation, and lightness meters until you find a combination of text and background colors that is accessible and use those colors on your page. {% embed https://vimeo.com/786154480 %}

3. **Screen Reader Capability**: Use a screen reader to read the elements on the page. You should have the ability to read out all field labels, alternative text, headings, navigation, and error messaging. Choose your OS adventure:
  - MacOS: no downloads necessary! Macs have accessibility features out of the box
     - [Get started with accessibility features on Mac](https://support.apple.com/guide/mac-help/get-started-with-accessibility-features-mh35884/mac)
     - [Screen Reader Basics: VoiceOver -- A11ycasts #07 ](https://www.youtube.com/watch?v=5R-6WvAihms&t=1s)
  - Windows
     - [Download NVDA](https://www.nvaccess.org/download/)
     - [Screen Reader Basics: NVDA -- A11ycasts #09 ](https://www.youtube.com/watch?v=Jao3s_CwdRU)

4. **Keyboard Compatibility**: Use only the keyboard to interact with the elements on the page. You should have the ability to navigate menus, fill out and submit forms, open links, and open/close modals. Keyboard focus should also be visible (usually with a border highlight around the element).
  - Click in the browser address bar
  - Take your hand off your mouse/trackpad and use only your keyboard
  - Start tabbing around
  - Use Shift+Tab to navigate backward, spacebar activates checkboxes and buttons
     - A [handy list of which keystrokes to use](https://webaim.org/techniques/keyboard/#testing)
  - Look for focus and tabbing order. Can you get to all interactive objects?
     - Demo of browsing & interacting using a keyboard: [Browsing with a keyboard](https://www.youtube.com/watch?v=757suz8MTV8)

5. **Zooming In**: Check for loss of content or functionality by zooming in to 200% in the browser. 
  - Do any elements overlap other elements? i.e. an image overlaps text or navigation

 _______

### :clapper: Take Action to Remediate Issues

1. Fix issues identified in the automated audit and manual testing.
2. Run the audit and manually test again to make sure everything is fixed.
3. Pat yourself on the back! You made the page more inclusive!

_______

### :white_check_mark: Accessibility Testing Summary Checklist
Refer to this checklist each time you need to test for accessibility and use the instructions above as needed.

- Run an automated audit using Google Chrome Lighthouse or Accessible Web Extension.
- Check for a sufficient color contrast ratio for all text and background colors.
- Use a screen reader to read the elements on the page.
- Start in the browser address bar and use only the keyboard to interact with the elements on the page.
- Zoom in to 200% in the browser and check for any loss of content or functionality.
- Fix any issues detected.
 
_______

### :question: Resources and Training

W3C Web Accessibility Initiative’s more in-depth guide of easy things to do to test accessibility: [Easy Checks – A First Review of Web Accessibility](https://www.w3.org/WAI/test-evaluate/preliminary/)

W3C Web Accessibility Initiative’s official guidelines: [Web Content Accessibility Guidelines (WCAG) 2.1](https://www.w3.org/TR/WCAG21/#later-versions-of-accessibility-guidelines)


<small> Cover photo by <a href="https://unsplash.com/@elizabeth_woolner?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Elizabeth Woolner</a></small>