Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fejes713/accessibility-guide
A curated collection of web accessibility tips, tricks, and best practices
https://github.com/fejes713/accessibility-guide
Last synced: 19 days ago
JSON representation
A curated collection of web accessibility tips, tricks, and best practices
- Host: GitHub
- URL: https://github.com/fejes713/accessibility-guide
- Owner: fejes713
- License: mit
- Created: 2019-02-14T11:22:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T03:23:09.000Z (almost 2 years ago)
- Last Synced: 2024-04-17T05:10:07.464Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.63 MB
- Stars: 536
- Watchers: 11
- Forks: 22
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Accessibility GuideA curated collection of web accessibility tips, tricks and best practices
## Table of Contents
### Tips
View contents
* [Always include alt attribute on an image](#always-include-alt-attribute-on-an-image)
* [Avoid auto-playing audio on your website](#avoid-auto-playing-audio-on-your-website)
* [Buttons that only show up on hover](#buttons-that-only-show-up-on-hover)
* [Always feature optimal contrast](#always-feature-optimal-contrast)
* [Don't remove `:focus` on elements](#dont-remove-focus-on-elements)
* [Use labels on `form` fields](#use-labels-on-form-fields)
* [Make self-validating forms accessible](#make-self-validating-forms-accessible)
* [Follow heading hierarchy](#follow-heading-hierarchy)
* [Avoid non-semantic patterns](#avoid-non-semantic-patterns)
* [Use skip-links](#use-skip-links)
* [Make `tab` friendly navigation](#make-tab-friendly-navigation)
* [When you need to display tabular data use `table` instead series of `div` elements](#when-you-need-to-display-tabular-data-use-table-instead-series-of-div-elements)### Pro Tips
View contents
* [Alert user for updates](#alert-user-for-updates)
* [Put a full stop at the end of the `alt` attribute](#put-a-full-stop-at-the-end-of-the-alt-attribute)
* [Allow user to stop an animation](#allow-user-to-stop-an-animation)
* [Avoid `alt` tags on images of your logo](#avoid-alt-tags-on-images-of-your-logo)
* [Tables should always include scoping in their HTML](#tables-should-always-include-scoping-in-their-html)
* [Avoid poor video captions](#avoid-poor-video-captions)### Facts
View contents
* [HTML should have a logical flow](#html-should-have-a-logical-flow)
* [Don't rely just on Lighthouse when testing](#dont-rely-just-on-lighthouse-when-testing)
* [Improve typography on your website](#improve-typography-on-your-website)---
## Tips
### Always include alt attribute on an imageScreen readers for the blind and visually impaired read out `alt` attribute text and therefore make your images accessible. `alt` attribute should describe meaningful images and be left empty if the image serves decorative purposes. Never leave the `alt` since screen readers will read the source of the image which makes for terrible user experience.
#### Resources
* [Some things about alt text](https://css-tricks.com/some-things-about-alt-text/)
[⬆ Back to top](#table-of-contents)### Avoid auto-playing audio on your website
Do not auto-play any audio or video material on page load. Users with screen readers will hear both 3rd party audio and their screen reader which makes for a poor user experience.
[⬆ Back to top](#table-of-contents)### Buttons that only show up on hover
Be mindful of a pattern where buttons are hidden and only get displayed when parent element is hovered: this can make the buttons inaccessible from keyboard. instead us using `display:none` or `visibility: hidden`, consider using alternative methods, e.g. using `position: absolute` and pushing it off the screen.
#### Resources
* [See how angular hides elements with cdk-visually-hidden class](https://cs.corp.google.com/piper///depot/google3/third_party/javascript/angular2_material/src/cdk/a11y/_a11y.scss)
[⬆ Back to top](#table-of-contents)### Always feature optimal contrast
Whenever possible make your websites accessible to the eye by avoiding poor contrast between text and background.
#### Resources
* [Accessible color picker](https://cloudflare.design/color/)
* [Accessible color compliance checker](http://accessible-colors.com)
* [Color contrast docs by MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable/Color_contrast)
[⬆ Back to top](#table-of-contents)### Don't remove `:focus` on elements
If an element is interactive never remove the highlight by setting `outline: none;` on a focused state of that element. If the default browser outline doesn't align with the design be sure to replace it with a custom accessible one instead of hiding it completely. Removing an element's highlight on focus makes filling out forms difficult for some users.
#### Resources
* [Focusing on Focus Styles](https://css-tricks.com/focusing-on-focus-styles/)
[⬆ Back to top](#table-of-contents)### Use labels on `form` fields
Once implemented properly, `label` elements make the form accessible. Each `label` element should have a `for` attribute that has the value of the corresponding filed's `id`.
#### Resources
* [The `label` element docs](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/How_to_structure_an_HTML_form#The_%3Clabel%3E_element)
[⬆ Back to top](#table-of-contents)### Make self-validating forms accessible
If your form needs to meet specific input criteria and errors on mistaken input be sure to provide feedback to the user. Alongside the common red border include a text-based informative explanation of the encountered error.
#### Resources
* [Sensible Forms: A Form Usability Checklist](https://alistapart.com/article/sensibleforms)
[⬆ Back to top](#table-of-contents)### Follow heading hierarchy
Screen reader users navigate pages by using the heading structure. Do not use headings by picking the one that fits the appropriate size in design. Instead, use heading elements `h1` to `h6` with the hierarchy in mind and style them later.
#### Resources
* [Headings](https://www.w3.org/WAI/tutorials/page-structure/headings/)
[⬆ Back to top](#table-of-contents)### Avoid non-semantic patterns
Use semantic HTML elements that clearly define their content as much as possible. By using semantic elements you provide the user with a more meaningful way to navigate and interact with your website. Semantic elements, such as ``, `` and `` are by default accessible compared to non-semantic elements like `
` or ``. Avoid using non-accessible `