• Stars
    star
    281
  • Rank 146,314 (Top 3 %)
  • Language
    HTML
  • Created over 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Repository on accessibility

Accessibility (a11y)

Improving accessibility, by example

Quick Start

Install Node, then run the following on the command line:

npm install
npm start

The commands above will install necessary dependencies, then start the app on your machine.

The master branch contains an app with bad accessibility. Checkout the fixed branch to try the app with improved accessibility. Use the screen readers below to see the huge difference.

Slides

Slides from "Building Accessible Web Apps"

Why

  • It's the right thing to do
  • It makes development and test easier too by encouraging semantic markup
  • The American Council for the Blind and others are filing suits. Number/year keeps growing.

A11y Tips

  • The first rule of ARIA: Don't use ARIA. Consider it a last resort. Start with semantic HTML.
  • Read the other rules of ARIA
  • "Shift a11y left" - Design in a11y from the start. Don't merely put the onus on developers. Designers should design for a11y. Examples:
    • Anything a mouse can do, a keyboard user needs to be able to do.
    • Figma tools like Stark and A11y Annotation Kit allow designers to convey a11y info.
    • Visual treatments should have sufficient contrast and not rely upon color alone. Use WCAG contrast checker
  • Semantic HTML is the foundation. div or span is a last resort. Use the tag that's designed for the job. Avoid creating custom elements when a native one exists. Here's an example where a custom element was useful
  • aria-label is basically only for interactive and landmark elements.
  • Role is a last resort. Again, prefer a specific tag first.
    • h1 has a role="heading
    • button has role="button"
    • section has role="region"
    • footer has role="complimentary",
    • header has role="banner" (when not nested under aside, article, main, nav, or section.) (and yes, header/footer can be used elsewhere in the page to mark up headers footers for sections too.
  • The most broadly useful roles (because they don't have an HTML tag equivalent):
    • feed
    • img (for grouping separate images together for a shared description)
    • search - Apply to search input's form tag
    • switch - For 2 on/off states, like a more specific checkbox.
    • tab
  • Be deliberate and careful with motion. Check prefers-reduced-motion and minimize motion if set.
  • Add a heading to each major section of the UI, like navigation, even if visually hidden because many screen reader users don’t navigate by landmarks but do navigate by headings.
  • After client-side routing, Provide a skip link that takes focus on a route change within the site, with a label that indicates what the link will do when activated: e.g. "skip to main navigation". Include an ARIA Live Region on page load. On a route change, append text to it indicating the current page, e.g. "Portfolio page".
  • Avoid built-in form validation. Ironically, it's not accessible
  • Consider HTML order. Remember that screen readers read top down. So avoid putting extraneous things before the main content (sharing, tags, ads, etc)
  • For toggles, make it clear whether it's selected. And what will happen if it's clicked. For example prefer "Currently muted, click to unmute" over "muted".
  • Announce when something is expanded or collapsed.
  • Avoid spelling phonetically because Braille readers get confused. Screen reader users are used to words being mispronounced.
  • Set the tabindex=-1 to convey that something can only be focused via a func call. Useful for headers that you want to focus programmatically when an anchor is clicked.
  • WCAG text notes - If the text is 18pt / 24 px or larger, it counts as “large-scale text” and only needs to meet a 3:1. For headings to pass 3:1, they need to be at least 24 px (or 14px bold). A submit button is a user interface component, so it also only needs to meet 3:1. WCAG defines a user interface component as “a part of the content that is perceived by users as a single control for a distinct function”. A submit button is a single control, sitting on its own line with padding and a background color. If it were a text link in the middle of a paragraph, it wouldn’t meet the same requirements and would thus need to meet 4.5:1. Unless it was 24px or larger!

A11y Audit Checklist

  • Is first tab "skip to main content"?
  • Are form labels tied to the input?
  • Are form errors announced immediately, and marked as errors?
  • Do toggles and buttons announce their state via aria-pressed?
  • Is aria-haspopup used for elements trigger a popup?
  • Are required fields marked via aria-required (or the required attribute if you want native behavior)?
  • Are invalid fields (that failed validation) marked via aria-invalid?
  • Do errors have a role="alert"?
  • Are any buttons disabled? Don't. Disabled buttons suck. Instead, use aria-disabled and ignore clicks. Or, consider these disabled button approaches and alternatives. My tweet on this
  • Is Navigation well-named?
  • Open the screen reader's rotor: Are links, heading, buttons all well named? (Avoid links with text of "click here"). Do headings start at h1 and descend logically?
  • Is the HTML lang tag set when the language changes?
  • Is autocomplete set on the relevant form fields?
  • Are aria-live and a skip link being used to announce new content/alerts/pages? Note: The aria-live attribute must be present in the DOM right from the beginning, even if the element doesn’t hold any message yet, otherwise, Assistive Technologies may not work properly.
  • Is aria-current being used to mark and style active links?
  • Can I navigate the app via the keyboard in a logical order? Can I always see what is focused? (use inert for invisible, rendered elements). Check tab, arrows keys, focus rings, escape.
  • Are radios and other related fields wrapped in a fieldset? - NOTE: When you do, wrap each radio in a div, not a p
  • Is the input type specified as specific as possible?
  • Is aria-busy being used? Don't. Few screenreaders honor it, and it ironically makes the content inaccessible
  • Is the title attribute used anywhere? Don't. It hides content from mobile and tablet users as well as assistive tech users and keyboard only users.
  • When I click on a link, does it focus the proper item? If I click an anchor, does it focus the heading?
  • Is the markup semantic? Does it use the most specific tag possible.
  • Does the app work well zoomed in? Are font sizes declared in em/rem? Other values like padding/margin/border width should be declared via pixels so they don't change and take up a bunch of space when the user has font size/zoom cranked up (which would make content harder to read by making each line very short). Rule: If the value should increase with the default font size, use rem. Otherwise, use px.
  • Search the code: Where is role used? Could a semantic tag be used instead?
  • Are useful landmarks displayed in the rotor? (Use good semantic markup, and apply roles when semantic markup isn't possible/sufficient)
  • Are buttons and anchors being used as intended? They operate differently. (search code for these tags to focus audit). My summary in a tweet
  • Have we reviewed everything that can't be automated that's on a11y-automation? This site lists the status of each thing to check, and whether it can be automated.

A General Audit Workflow (h/t to Marcy Sutton)

  1. Make sure things are rendered in the browser as expected.
  2. Try navigating the site with only my keyboard, taking note of what does and doesn't work.
  3. Scan the page with developer tools (Accessibility Insights is one of my go-tos).
  4. Take note of how screen readers behave on Mac, Windows, and even mobile devices & emulators.
  5. Zoom in and out and watch for how content reacts. The Web Content Accessibility Guidelines (WCAG) state that in order to be accessible, a site should be usable at 200% zoom. This number is really a minimum - many folks with vision disorders often zoom any farther.

Once I've got a list of things that need addressed from the user side of things, I start in on the code. I often start conversations with Creative/Design teams as well to prevent accessibility issues earlier in the software development lifecycle.

As I dive in to fix accessibility problems with code, I prioritize them based on user impact and the Web Content Accessibility Guidelines. I aim to fix things one viewport size at a time, though it's important to double check that changes in one place don't have an effect on others.

What about Accessibility Overlays?

Aviod them. There's no free lunch. Here's more on why

A11y Tools

Automated testing

Many queries in jest-dom help encourage a11y:

Accessible UI Components

These sites contain UI components that are focused on a11y. Good to use as foundations or as inspiration.

Screen Readers

Resources

Training

I offer on-site training and consulting on JavaScript, React, and accessibility at reactjsconsulting.com.

NVDA Cheatsheet

  • I prefer configuring it to use the Caps Lock key as the NVDA key.
  • NVDA+n activates the NVDA menu

Chrome Screen Reader Extension (formerly called Chromevox) Cheatsheet

Chromevox docs

  • Chromevox = Ctrl+cmd on Mac
  • Chromvox + . = Show all commands and search box
  • Navigate elements: Ctrl+cmd+arrows

Announce table cell header:

  • Cmd+ctrl+backslash while reading table cell to enter table mode.
  • Cmd+ctrl+T+H to announce current cell's headers.

VoiceOver Cheatsheet

  • Open/close: CMD+F5 (or, via toolbar if enabled in preferences)
  • "VO" default chord: Ctrl+Alt
  • Mute: Ctrl
  • Rotor: VO+U (so Ctrl+Alt+U), then use left/right arrows to shift between
  • Quick Nav: Hold both arrow keys to toggle. (allows navigating via arrows). Press up down to change sections, left right to nav within a section. Note that tables read out the headers as you navigate the content. To Nav between table cells: Ctrl+Alt+arrow.
  • TIP: Voiceover works best in Safari. Avoid using Voiceover on a browser with many tabs/windows open. Doing so will cause it to take a long time to initialize. So if you have many tabs open in Chrome for instance, use Firefox or Safari.
  • More tips / keyboard shortcuts

iPhone VoiceOver Cheatsheet

  • Use two finger rotation to engage the rotor
  • Drag one finger around the screen to explore via touch
  • Swipe left and right with one finger to move the cursor one element at a time
  • Double tap with one finger to activate the current element
  • 2 finger tap to pause VoiceOver speaking

More Repositories

1

react-slingshot

React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
JavaScript
9,751
star
2

pluralsight-redux-starter

Completed Dev Environment for "Building Applications with React and Redux" on Pluralsight
JavaScript
1,285
star
3

speaker-starter-kit

Resources for aspiring speakers
797
star
4

react-flux-starter-kit

Quickly get started with React and Flux using Browserify and Gulp
JavaScript
684
star
5

reactjsconsulting

React Related Resources
JavaScript
323
star
6

javascript-development-environment

JavaScript development environment discussed in "Building a JavaScript Development Environment" on Pluralsight
JavaScript
298
star
7

timeless-skills

These are the timeless skills I wish I’d learned in school, and the resources I recommend to learn them.
273
star
8

ps-react

Reusable React components built in "Creating Reusable React Components" on Pluralsight
JavaScript
136
star
9

mock-api-example

Example Mock API for rapid development
JavaScript
122
star
10

graphql

Resources for learning GraphQL.
111
star
11

switchboard

Toolkit for creating custom DevTools for React projects
TypeScript
108
star
12

react-state-demo

This app showcases eight ways to handle React state.
JavaScript
76
star
13

7-pillar-developer

7 Pillar Developer Talk Repo
59
star
14

react-flux-building-applications

Final version of demo app for React and Flux course on Pluralsight
JavaScript
57
star
15

react-tour-of-heroes

Implementation of Angular 2's "Tour of Heroes" Tutorial in React
JavaScript
54
star
16

ama

Ask me anything.
40
star
17

dynamic-import-example

Showcase using ES dynamic imports in create-react-app
JavaScript
31
star
18

shell

Module Federation demo
TypeScript
30
star
19

devup-2017

Repository for "Build a JS Dev Environment in 1 Hour" at DevUp 2017
JavaScript
27
star
20

testing-react

Testing Demo App
JavaScript
21
star
21

get-started-in-programming

Resources for people just getting started in programming
19
star
22

outlierdeveloper

OutlierDeveloper.com
19
star
23

js-dev-env-demo

Course demo
JavaScript
17
star
24

react-auth0-final

The final app used to record the course
JavaScript
16
star
25

fluent2017

JavaScript Development Environment for Fluent 2017
JavaScript
15
star
26

js-dev-env-demo-api

API for JS Dev Env Demo in Pluralsight course
JavaScript
13
star
27

react-umd-example

Example of consuming a UMD React component
JavaScript
12
star
28

vite-project

A reference project for using Vite and Vitest with React
TypeScript
12
star
29

clean-coding-principles-c-sharp

Demo for "Clean Coding Principles in C#" on Pluralsight
C#
11
star
30

pluralsight-reusable-react-components

WIP for scripting demo
JavaScript
8
star
31

farfetch

8
star
32

mock-data-pattern

Example of centralized mock data pattern for React apps
JavaScript
8
star
33

pro-javascript-bootcamp

Pro JavaScript Bootcamp
JavaScript
7
star
34

angular-2-tour-of-heroes

Implementation of Angular 2's "Tour of Heroes" Tutorial
JavaScript
7
star
35

pluralsight-reusable-components-cra

Building reusable components with create-react-app as foundation
JavaScript
7
star
36

fluent2016

"React and Flux from Scratch" - Tutorial for Fluent 2016 in San Francisco
JavaScript
6
star
37

isomorphic-demos

List of Isomorphic Demos I've found across the web
6
star
38

react-typescript-starter-kit

Simple starter kit that shows how TypeScript and React can work together
JavaScript
6
star
39

CleanCodePresentation

Clean Code Presentation Example Application
JavaScript
6
star
40

typescript-react

Kicking the tires on TypeScript with React
TypeScript
6
star
41

fluent2016complete

The completed Fluent2016 Demo at https://github.com/coryhouse/fluent2016
JavaScript
6
star
42

create-react-library

Create a React component library project via a configurable command line
5
star
43

skillpath-react

React training at Skillpath
JavaScript
5
star
44

react-state-managing

Repo for Managing React State on Pluralsight
JavaScript
5
star
45

everlaw-shoes

TypeScript
5
star
46

pluralsight-clean-code-demo

C#
5
star
47

js-async-patterns

Examples of Async patterns in JS
JavaScript
5
star
48

acutrack-react

JavaScript
5
star
49

my-component

React component created by nwb
JavaScript
4
star
50

js-blurb

Short blurb on JS
4
star
51

mobx

MobX Demo
JavaScript
3
star
52

repo-template

A repo template with the key pieces included
3
star
53

react-flux

JavaScript
3
star
54

americo-react

TypeScript
3
star
55

taxslayer

JavaScript
2
star
56

vite-pwa-app

Vite app using vite-pwa plugin to notify upon deployment
MDX
2
star
57

nextjs-13-demo

TypeScript
2
star
58

paycor

JavaScript
2
star
59

vercel-pluralsight-demo

Demo of hosting Next.js on Vercel
JavaScript
2
star
60

charleston-digital-hub

Course management app
JavaScript
2
star
61

eboss

JavaScript
2
star
62

malle-sept

JavaScript
2
star
63

html5-web-components

Repo for HTML5 Web Component Fundamentals on Pluralsight
2
star
64

xstate-demo

Xstate with React demo
TypeScript
2
star
65

DependencyInjectionExample

Dependency Injection example
JavaScript
2
star
66

athena-watertown

React app
JavaScript
2
star
67

managing-react-state-kcdc-2021

Demo code for "Managing React State: 7 Years of Lessons Learned" at KCDC 2021
JavaScript
2
star
68

react-state-options

Contrast React state options
2
star
69

react-rendering-service

Returns HTML of React component via webservice
JavaScript
2
star
70

trpc-demo

TypeScript
2
star
71

remix-jokes

Remix jokes tutorial
TypeScript
2
star
72

advanced-react-starter

Starter project for advanced React
JavaScript
2
star
73

babel-node

Shows how babel-node throws an error when you hit ctrl+c instead of exiting clean
JavaScript
2
star
74

shell-monorepo-poc

TypeScript
2
star
75

fds-theming

TypeScript
2
star
76

kcdc24

2
star
77

swa-react

JavaScript
1
star
78

percy-demo

Demo of using Percy for automated image-based testing
JavaScript
1
star
79

kcdc2019-react

React Precompiler
JavaScript
1
star
80

react-monorepo

A monorepo supporting multiple teams contributing separate pieces of a large React app
1
star
81

oclc-react-restaurant

TypeScript
1
star
82

e-gineering

React workshop for e-gineering
TypeScript
1
star
83

storybook-css-bug

JavaScript
1
star
84

akin-gump

JavaScript
1
star
85

ps-dev-env-script

Use to create script from ground up
JavaScript
1
star
86

slingshot-fork

JavaScript
1
star
87

everkicks

Shoe store for Everlaw React training
JavaScript
1
star
88

reactjsconsulting.com

reactjsconsulting.com Source Code
JavaScript
1
star
89

remote-2

Shell tech demo remote app 2
TypeScript
1
star
90

tideworks

JavaScript
1
star
91

react-via-cdn

Simple example of using React via a CDN
HTML
1
star
92

crap-okta-from-scratch

Connect create-react-app app to OKTA from scratch
JavaScript
1
star
93

Helmes

React and JavaScript consulting
JavaScript
1
star
94

hallmark

eCards App
JavaScript
1
star
95

next-trpc-demo

Demo of using tRPC with Next.js
TypeScript
1
star
96

kiewit-react

JavaScript
1
star
97

oberhaching-react

Library app
TypeScript
1
star
98

react-restaurant-assets

Assets for a restaurant app built in React
TypeScript
1
star
99

magellan

JavaScript
1
star
100

conf-app-connecttech-2021

TypeScript
1
star