When to Use Lists for Better Accessibility

When creating HTML content, using lists appropriately is crucial for accessibility, especially for screen reader users. Here’s a breakdown of when to use different types of lists and why.
When to Use Lists
Logical Sequences
Use ordered lists (<ol>) when the order of items is essential. Examples include:
- Steps in a recipe or instructions
- Ranking or priority lists
- Chronological events
Screen readers announce the number of items and their position within the list, providing context and structure.
Unordered Collections
Use unordered lists (<ul>) when the order of items doesn’t matter. Examples include:
- Navigation menus
- Bullet point lists of features or benefits
- Lists of related links
Screen readers announce the list as a collection of items, but don’t imply any specific order.
Definition Lists
Use description lists (<dl>) when you need to associate terms with their definitions or descriptions. Examples include:
- Glossaries
- Frequently asked questions (FAQs)
- Metadata or key-value pairs
Screen readers announce the term (<dt>) and its definition (<dd>) as a related pair, providing clear context. (Note: support varies from system to system; use with caution and always test.)
When to not use lists
It’s easy to reach for a list structure to provide structural semantic meaning for your content. However, sometimes, a list can actually hinder the user experience. Here’s common patterns to consider avoiding wrapping with lists.
Product Cards
Product cards are often used to quickly share product information in a compact way. These components often include:
- Product title
- Product description
- Price information
- Links to learn more about the product
Product cards include a lot of information which may overwhelm the user when used within a list.
Tabular Data
Tabular data can visually appear as list-like, depending on the content, but this is not often the case under the hood. Table components often include:
- Visible column and row headings
- Methods to sort the data
- Links to learn more about the line item
- Buttons to edit or remove the line item
Screen reader users have specific ways to navigate tabular data which helps with content consumption. Using a list here wouldn’t be appropriate.
Why Proper List Usage Matters for Screen Readers
Semantic Structure
Lists provide semantic meaning to the content, which screen readers rely on to interpret and convey information. Using the correct list type helps screen readers understand the relationship between items and the overall structure of the content.
Navigation and Comprehension
Screen readers allow users to navigate lists efficiently, jumping between items and understanding the list’s context. Properly structured lists make it easier for users to comprehend the information and follow the flow of the content.
Accessibility Standards
Following accessibility guidelines, such as WCAG (Web Content Accessibility Guidelines), requires using semantic HTML elements like lists appropriately. This ensures that content is accessible to a wider range of users, including those with disabilities.
Avoiding Misuse
It is very important to not use lists for purely visual layout. Using lists to create columns or other visual effects is an anti-pattern. CSS should be used for all visual styling. This keeps the HTML semantic.
Key Considerations
- Nested lists: You can nest lists within other lists to create hierarchical structures, which can be helpful for complex information. Screen readers handle nested lists effectively.
- Clear and concise content: Keep list items concise and easy to understand.
- Avoid empty list items: Empty list items can confuse screen reader users.
- Use proper HTML: Always use the correct HTML elements for each type of list.
- Test with screen readers: Regularly test your content with screen readers to ensure that it is accessible and usable.
By using lists appropriately, you can create more accessible and user-friendly web content for everyone.