About the Web Accessibility Cookbook
The Web Accessibility Cookbook focuses on the technical side of web accessibility.
You’ll learn how to build common patterns written accessibly in HTML, CSS, and JavaScript. You’ll also start to understand how good and bad practices affect people, especially those with disabilities.
Great for quick answers on what pattern is best to use, with good explanations why, for those who want to know more.
Sara Joy Web Developer, Pirate Ship Software GmbH
It's' available in print, PDF, EPub, and HTML on the O'Reilly Learning Platform.
Table of contents
1. Structuring Documents
Chapter 1 focuses on those parts of your websites that recur and are similar or identical on every page. You will learn how to set up the <head>
and create a base structure in the <body>
.
Recipes
- Define the natural language
- Describe the document
- Set the viewport width
- Optimize rendering order
- Structure the document
2. Structuring Pages
In Chapter 2, you leave the base structure of your website and move into the page itself. The foundation of a well-designed page is grouping elements, landmarks, and headings. You learn how to use <section>, <nav>, or <article> efficiently and how to combine them with headings to create a sound document outline.
Recipes
- Create navigation landmarks
- Create form landmarks
- Label landmarks
- Structure the main content
- Create a sound document outline
- Present content in order
3. Linking Content
Hyperlinks are the basis of the World Wide Web. That is why Chapter 3, which is all about linking content, is one of the book’s most extensive chapters. It analyzes the characteristics of the <a> element and helps you apply it efficiently. You’ll learn how to link different types of content, images, and groups of elements. One recipe focuses on client-side routing and what to consider when linking pages in a single application. Another addresses how to visually style links.
Recipes
- Pick the right element
- Style links
- Create download links
- Create email links
- Link images
- Inform users of changing context
- Fix client-side rendering
- Add links to groups of elements
4. Performing Actions
Chapter 4 is similar to the previous chapter, except that it puts the <button> element in the spotlight. You’ll learn different techniques for labeling buttons and how to use them with the most common ARIA attributes.
Recipes
- Pick the right element
- Label buttons clearly
- Remove default button styles
- Add states and properties
- Don’t disable buttons
5. Styling content
In Chapter 5, we move from HTML to CSS and discuss color, contrast, animation, units, and sizes. You’ll learn how to write CSS in a way that respects users’ preferences.
Recipes
- Work with color
- Respect user preferences
- Work with units and sizes
- Preserve semantic information and operability
- Add motion and animation
6. Managing Focus
Keyboard accessibility is an important topic in this book. Chapter 6 outlines everything you need to know about focus styling, focus management, and DOM order.
Recipes
- Provide focus styles
- Make elements focusable
- Move focus
- Keep focus contained
- Preserve order
- Allow users to skip elements
7. Navigating Sites
Almost every website has a main navigation. Chapter 7 dissects a typical site navigation and explains every part in detail, explaining why certain semantic elements can be useful for screen reader users. You’ll learn how to create responsive navigation with submenus and understand the difference between navigations and menus.
Recipes
- Create a Main Navigation
- Highlight the active page
- Announce the number of items
- Provide quick access
- Hide the navigation on narrow viewports
- Add a slide-in animation
- Add sub menus
- Avoid confusion with menus
8. Toggling Content Visibility
There are different ways of hiding content in CSS and HTML. Chapter 8 discusses their pros and cons. You’ll learn how to create disclosure widgets and accordions. The chapter also compares the native <details> element with custom solutions.
Recipes
- Hide content
- Create a native disclosure widget
- Create a custom disclosure widget
- Create groups of disclosure widgets
9. Constructing Forms
Chapter 9 focuses on a complex topic: forms. It starts with general best practices for creating forms and gets more specific with every recipe. You’ll learn the most important aspects of form design: labeling, description of form elements, error management, and grouping.
Recipes
- Create forms
- Identify form elements
- Describe form fields
- Highlight erroneous fields
- Group fields in a form
- Split forms into steps
10. Filtering Data
In Chapter 10, you’ll learn how to build a filter form from start to finish. You’ll also be introduced to dynamic feedback for screen reader users, pagination, and sorting.
Recipes
- Create a form
- Filter the data
- Paginate results
- Sort and display results
- Group filters
11. Presenting Tabular Data
Tables are misused so much that many developers are afraid of working with them. Chapter 11 demystifies the <table> element and presents best practices and guidance for using it. It also explains how to sort tables and combine them with interactive elements.
Recipes
- Pick the right elements
- Structure tables
- Add interactive elements
- Sort columns
12. Creating custom elements
Custom elements are an exciting standard and, paired with other APIs, a powerful tool for creating web components. Chapter 12 explains everything you must consider regarding accessibility when working with them.
Recipes
- Working with IDs
- Creating ARIA references
- Focus elements in Shadow DOM
- Debugging and testing
- Enforce best practices
13. Debugging Barriers
Trust is good; control is better. Chapter 13 introduces you to automatic testing and debugging tools that help you identify, debug, and fix accessibility issues.
Recipes
- Find accessibility issues automatically
- Explore the accessibility tree
- Debug roles, names, properties, and states
- Visualize tabbing order
- Emulate color deficiencies, reduced motion, and more
- Write custom debugging rules