Skip to content

Commit a28c09e

Browse files
committed
πŸ“– DOC: Accessibility a11y Standards and Guidelines
1 parent 822dd58 commit a28c09e

1 file changed

Lines changed: 194 additions & 0 deletions

File tree

β€Žexamples/05-a11y-input/README.mdβ€Ž

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,197 @@ This example includes a WordPress Gutenberg plugin called `a11y-input` which cre
1919

2020
_That's about it._
2121
>🌟 Star for updates or to appreciate [create-guten-block β†’](https://github.com/ahmadawais/create-guten-block)
22+
23+
24+
<br>
25+
26+
![Accessibility a11y](https://on.ahmda.ws/96c015/c)
27+
28+
### Accessibility `a11y` Standards and Guidelines
29+
30+
Web accessibility (also referred to as [a11y](https://en.wiktionary.org/wiki/a11y)) is the design and creation of websites that can be used by everyone. Accessibility support is necessary to allow assistive technology to interpret web pages.
31+
32+
### WCAG
33+
34+
The [Web Content Accessibility Guidelines](https://www.w3.org/WAI/intro/wcag) provides guidelines for creating accessible web sites.
35+
36+
The following WCAG checklists provide an overview:
37+
38+
- [WordPress `a11y` β†’](https://codex.wordpress.org/Accessibility)
39+
- [React.js `a11y` β†’](https://reactjs.org/docs/accessibility.html)
40+
- [WCAG checklist from Wuhcag](https://www.wuhcag.com/wcag-checklist/)
41+
- [WCAG checklist from WebAIM](http://webaim.org/standards/wcag/checklist)
42+
- [Checklist from The A11Y Project](http://a11yproject.com/checklist.html)
43+
44+
### WAI-ARIA
45+
46+
The [Web Accessibility Initiative - Accessible Rich Internet Applications](https://www.w3.org/WAI/intro/aria) document contains techniques for building fully accessible JavaScript widgets.
47+
48+
Note that all `aria-*` HTML attributes are fully supported in JSX. Whereas most DOM properties and attributes in React are camelCased, these attributes should be hyphen-cased (also known as kebab-case, lisp-case, etc) as they are in plain HTML:
49+
50+
```javascript{3,4}
51+
<input
52+
type="text"
53+
aria-label={labelText}
54+
aria-required="true"
55+
onChange={onchangeHandler}
56+
value={inputValue}
57+
name="name"
58+
/>
59+
```
60+
61+
## Other Points for Consideration
62+
63+
### Setting the language
64+
65+
Indicate the human language of page texts as screen reader software uses this to select the correct voice settings:
66+
67+
- [WebAIM - Document Language](http://webaim.org/techniques/screenreader/#language)
68+
69+
### Setting the document title
70+
71+
Set the document `<title>` to correctly describe the current page content as this ensures that the user remains aware of the current page context:
72+
73+
- [WCAG - Understanding the Document Title Requirement](https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-title.html)
74+
75+
We can set this in React using the [React Document Title Component](https://github.com/gaearon/react-document-title).
76+
77+
### Color contrast
78+
79+
Ensure that all readable text on your website has sufficient color contrast to remain maximally readable by users with low vision:
80+
81+
- [WCAG - Understanding the Color Contrast Requirement](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)
82+
- [Everything About Color Contrast And Why You Should Rethink It](https://www.smashingmagazine.com/2014/10/color-contrast-tips-and-tools-for-accessibility/)
83+
- [A11yProject - What is Color Contrast](http://a11yproject.com/posts/what-is-color-contrast/)
84+
85+
It can be tedious to manually calculate the proper color combinations for all cases in your website so instead, you can [calculate an entire accessible color palette with Colorable](http://jxnblk.com/colorable/).
86+
87+
Both the aXe and WAVE tools mentioned below also include color contrast tests and will report on contrast errors.
88+
89+
If you want to extend your contrast testing abilities you can use these tools:
90+
91+
- [WebAIM - Color Contrast Checker](http://webaim.org/resources/contrastchecker/)
92+
- [The Paciello Group - Color Contrast Analyzer](https://www.paciellogroup.com/resources/contrastanalyser/)
93+
94+
## Development and Testing Tools
95+
96+
There are a number of tools we can use to assist in the creation of accessible web applications.
97+
98+
### The keyboard
99+
100+
By far the easiest and also one of the most important checks is to test if your entire website can be reached and used with the keyboard alone. Do this by:
101+
102+
1. Plugging out your mouse.
103+
1. Using `Tab` and `Shift+Tab` to browse.
104+
1. Using `Enter` to activate elements.
105+
1. Where required, using your keyboard arrow keys to interact with some elements, such as menus and dropdowns.
106+
107+
### Development assistance
108+
109+
We can check some accessibility features directly in our JSX code. Often intellisense checks are already provided in JSX aware IDE's for the ARIA roles, states and properties. We also have access to the following tool:
110+
111+
### Testing accessibility in the browser
112+
113+
A number of tools exist that can run accessibility audits on web pages in your browser. Please use them in combination with other accessibility checks mentioned here as they can only
114+
test the technical accessibility of your HTML.
115+
116+
#### aXe, aXe-core and react-axe
117+
118+
Deque Systems offers [aXe-core](https://github.com/dequelabs/axe-core) for automated and end-to-end accessibility tests of your applications. This module includes integrations for Selenium.
119+
120+
[The Accessibility Engine](https://www.deque.com/products/axe/) or aXe, is an accessibility inspector browser extension built on `aXe-core`.
121+
122+
You can also use the [react-axe](https://github.com/dylanb/react-axe) module to report these accessibility findings directly to the console while developing and debugging.
123+
124+
#### WebAIM WAVE
125+
126+
The [Web Accessibility Evaluation Tool](http://wave.webaim.org/extension/) is another accessibility browser extension.
127+
128+
#### Accessibility inspectors and the Accessibility Tree
129+
130+
[The Accessibility Tree](https://www.paciellogroup.com/blog/2015/01/the-browser-accessibility-tree/) is a subset of the DOM tree that contains accessible objects for every DOM element that should be exposed
131+
to assistive technology, such as screen readers.
132+
133+
In some browsers we can easily view the accessibility information for each element in the accessibility tree:
134+
135+
- [Activate the Accessibility Inspector in Chrome](https://gist.github.com/marcysutton/0a42f815878c159517a55e6652e3b23a)
136+
- [Using the Accessibility Inspector in OS X Safari](https://developer.apple.com/library/content/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html)
137+
138+
### Screen readers
139+
140+
Testing with a screen reader should form part of your accessibility tests.
141+
142+
Please note that browser / screen reader combinations matter. It is recommended that you test your application in the browser best suited to your screen reader of choice.
143+
144+
### Commonly Used Screen Readers
145+
146+
#### NVDA in Firefox
147+
148+
[NonVisual Desktop Access](https://www.nvaccess.org/) or NVDA is an open source Windows screen reader that is widely used.
149+
150+
Refer to the following guides on how to best use NVDA:
151+
152+
- [WebAIM - Using NVDA to Evaluate Web Accessibility](http://webaim.org/articles/nvda/)
153+
- [Deque - NVDA Keyboard Shortcuts](https://dequeuniversity.com/screenreaders/nvda-keyboard-shortcuts)
154+
155+
#### VoiceOver in Safari
156+
157+
VoiceOver is an integrated screen reader on Apple devices.
158+
159+
Refer to the following guides on how activate and use VoiceOver:
160+
161+
- [WebAIM - Using VoiceOver to Evaluate Web Accessibility](http://webaim.org/articles/voiceover/)
162+
- [Deque - VoiceOver for OS X Keyboard Shortcuts](https://dequeuniversity.com/screenreaders/voiceover-keyboard-shortcuts)
163+
- [Deque - VoiceOver for iOS Shortcuts](https://dequeuniversity.com/screenreaders/voiceover-ios-shortcuts)
164+
165+
#### JAWS in Internet Explorer
166+
167+
[Job Access With Speech](http://www.freedomscientific.com/Products/Blindness/JAWS) or JAWS, is a prolifically used screen reader on Windows.
168+
169+
Refer to the following guides on how to best use JAWS:
170+
171+
- [WebAIM - Using JAWS to Evaluate Web Accessibility](http://webaim.org/articles/jaws/)
172+
- [Deque - JAWS Keyboard Shortcuts](https://dequeuniversity.com/screenreaders/jaws-keyboard-shortcuts)
173+
174+
### Other Screen Readers
175+
176+
#### ChromeVox in Google Chrome
177+
178+
[ChromeVox](http://www.chromevox.com/) is an integrated screen reader on Chromebooks and is available [as an extension](https://chrome.google.com/webstore/detail/chromevox/kgejglhpjiefppelpmljglcjbhoiplfn?hl=en) for Google Chrome.
179+
180+
Refer to the following guides on how best to use ChromeVox:
181+
182+
- [Google Chromebook Help - Use the Built-in Screen Reader](https://support.google.com/chromebook/answer/7031755?hl=en)
183+
- [ChromeVox Classic Keyboard Shortcuts Reference](http://www.chromevox.com/keyboard_shortcuts.html)
184+
185+
<br>
186+
187+
![ELSE ICON](https://on.ahmda.ws/oykk/c)
188+
189+
### Everything Else
190+
191+
This project was bootstrapped with [Create Guten Block](https://github.com/ahmadawais/create-guten-block).
192+
193+
Below you will find some information on how to run scripts.
194+
195+
>You can find the most recent version of this guide [here](https://github.com/ahmadawais/create-guten-block).
196+
197+
## πŸ‘‰ `npm start`
198+
- Use to compile and run the block in development mode.
199+
- Watches for any changes and reports back any errors in your code.
200+
201+
## πŸ‘‰ `npm run build`
202+
- Use to build production code for your block inside `dist` folder.
203+
- Runs once and reports back the gzip file sizes of the produced code.
204+
205+
## πŸ‘‰ `npm run eject`
206+
- Use to eject your plugin out of `create-guten-block`.
207+
- Provides all the configurations so you can customize the project as you want.
208+
- It's a one-way street, `eject` and you have to maintain everything yourself.
209+
- You don't normally have to `eject` a project because by ejecting you lose the connection with `create-guten-block` and from there onwards you have to update and maintain all the dependencies on your own.
210+
211+
---
212+
213+
###### β€” Feel free to tweet and say πŸ‘‹ at me [@MrAhmadAwais](https://twitter.com/mrahmadawais/)
214+
215+
[![npm](https://img.shields.io/npm/v/create-guten-block.svg?style=flat-square)](https://www.npmjs.com/package/create-guten-block) [![npm](https://img.shields.io/npm/dt/create-guten-block.svg?style=flat-square&label=downloads)](https://www.npmjs.com/package/create-guten-block) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/ahmadawais/create-guten-block) [![Tweet for help](https://img.shields.io/twitter/follow/mrahmadawais.svg?style=social&label=Tweet%20@MrAhmadAwais)](https://twitter.com/mrahmadawais/) [![GitHub stars](https://img.shields.io/github/stars/ahmadawais/create-guten-block.svg?style=social&label=Stars)](https://github.com/ahmadawais/create-guten-block/stargazers) [![GitHub followers](https://img.shields.io/github/followers/ahmadawais.svg?style=social&label=Follow)](https://github.com/ahmadawais?tab=followers)

0 commit comments

Comments
Β (0)