Skip to content

Instantly share code, notes, and snippets.

@manifestinteractive
Last active September 27, 2023 18:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manifestinteractive/45f36d4f4b079cf84e3c2ffee8ef0431 to your computer and use it in GitHub Desktop.
Save manifestinteractive/45f36d4f4b079cf84e3c2ffee8ef0431 to your computer and use it in GitHub Desktop.
Accessibility Testing

Introduction

A basic understanding of Accessibility Testing is essential for Web Developers to integrate into their daily web development practices.

The Google Chrome Developer team put together a fantastic intro series for accessibility testing.

StackShare

⚠️   ATTENTION:

Browser plugins like Lighthouse only test for ONE of the three tests listed below ( Visual Impairment ). If Lighthouse is all you are using, you are missing 2/3 of your accessibility issues.

Test #1: Visual Impairment

Some users have visual impairments where color contrast or combinations of colors could make a website impossible to use. We also want to be sure that visual elements have descriptive text for those that cannot see the content you embed into the page. Lastly, we want to make sure the page's overall structure makes sense for those accessing text-only versions of the website.

This type of accessibility test is the most common developers perform.

Here are the most common accessibility audit tools you can use for your preferred browser ( you only need one ):

Chrome

Safari

Firefox

Edge

Test #2: Keyboard Navigation

Some users cannot use a mouse to navigate a website and rely 100% on keyboard navigation. HTML elements have different keyboard navigation requirements.

This type of accessibility test is often overlooked by developers, and is not detected by plugins like Lighthouse. You do not need any special tools to test keyboard navigation — simply use your keyboard to make sure things work as expected.

macOS Users:

If you are using macOS, for some reason, Apple has disabled keyboard navigation support on the operating system level, as well as separatley in Safari browser, so you will need to make sure this is enabled to test this properly.

System Preferences: ( this will fix issues with Firefox )

preferences

Safari Preferences:

safari

Here is a breakdown of the different ARIA Roles of HTML elements and how keyboard navigation should work for each ( see "Keyboard Support" documentation for each example ):

NOTE: Each ARIA Role below also provides HTML Examples, CSS & JavaScript code needed to support Accessibility Requirements

ARIA Role Example
accordion Accordion
alertdialog Alert Dialog
article Feed
button Button
checkbox Two State
Mixed State
combobox Grid Popup
Listbox Popup
dialog Date Picker
Modal
feed Feed
grid Data Grid
Layout Grid
gridcell Layout Grid
group Image Carousel
Editor Menubar
Date Picker Spin Button
Navigation Treeview Using Computed Properties
Navigation Treeview Using Declared Properties
link Link
listbox ARIA 1.1 Combobox with Listbox Popup
Collapsible Dropdown Listbox
Listboxes with Rearrangeable Options
Scrollable Listbox
menu Actions Menu Button Using aria-activedescendant
Actions Menu Button Using element.focus()
Navigation Menu Button
Navigation Menubar
Editor Menubar
Toolbar
menubar Navigation Menubar
Editor Menubar
menuitem Actions Menu Button Using element.focus()
Navigation Menu Button
Navigation Menubar
Editor Menubar
menuitemcheckbox Editor Menubar
menuitemradio Editor Menubar
Toolbar
navigation Navigation Menu Button
Navigation Menubar
option Combobox with Listbox Popup
radio Radio Group Using Roving tabindex
Radio Group Using aria-activedescendant
Toolbar
radiogroup Radio Group Using Roving tabindex
Radio Group Using aria-activedescendant
Toolbar
row Combobox with Grid Popup
Layout Grid
Treegrid Email Inbox
separator Editor Menubar
slider Horizontal Multi-Thumb Slider
Horizontal Slider
Slider with aria-orientation and aria-valuetext
spinbutton Date Picker Spin Button
Toolbar
tab Tabs with Automatic Activation
Tabs with Manual Activation
tablist Tabs with Automatic Activation
Tabs with Manual Activation
tabpanel Tabs with Automatic Activation
Tabs with Manual Activation
toolbar Toolbar
tree File Directory Treeview Using Computed Properties
File Directory Treeview Using Declared Properties
Navigation Treeview Using Computed Properties
Navigation Treeview Using Declared Properties
treegrid Treegrid Email Inbox
treeitem File Directory Treeview Using Computed Properties
File Directory Treeview Using Declared Properties
Navigation Treeview Using Computed Properties
Navigation Treeview Using Declared Properties

Test #3: Screen Reader

Screen Readers rely heavily on Keyboard Navigation but require that the content also contain audible descriptions for those with visual impairments.

This accessibility test is often skipped entirely by developers as plugins like Lighthouse do not detect screen reader issues and are falsely perceived as difficult to test. There is a bit of a learning curve to get the hang of Screen Readers if you've never used one. Spending an initial 5-10 minutes getting used to the controls is usually all you need to learn the basics.

macOS / iOS

macOS / iOS comes with a native Screen Reader you can use called VoiceOver. Use the links below to learn more about this tool.

Windows

Windows users can install a free screen reader called NVDA. Use the links below to learn more about this tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment