Providing Long Descriptions for Complex Product Images (e.g., Infographics or Diagrams)
Description:
When product images are complex or convey critical information that cannot be fully captured in a short alt text, providing a long description ensures accessibility for users who are visually impaired. A long description can include detailed information about the image’s content, features, and purpose, helping screen reader users understand the full context.
Methods for Providing Long Descriptions #
aria-describedby: Usearia-describedbyto link the image to a nearby element containing the description.longdescAttribute: Though less commonly supported, thelongdescattribute provides a URL to a separate page or modal with a full description.<details>and<summary>Tags: These tags allow a collapsible description directly below the image, providing an expandable area that doesn’t clutter the page visually.
Example 1: Inline Long Description with aria-describedby
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product with Long Description</title>
<style>
/* Basic styling */
.product-container {
max-width: 600px;
margin: 0 auto;
}
.long-description {
margin-top: 10px;
font-size: 0.9em;
color: #333;
}
</style>
</head>
<body>
<div class="product-container">
<h2>Eco-Friendly Leather Backpack</h2>
<!-- Image with aria-describedby to point to long description -->
<img src="images/backpack.jpg" alt="Brown leather backpack" aria-describedby="backpack-description" width="400" height="500">
<!-- Detailed description with linked ID -->
<p id="backpack-description" class="long-description">
This eco-friendly leather backpack is designed for everyday use, made from sustainably sourced materials.
The backpack features multiple compartments, including a padded section for laptops up to 15 inches,
a front pocket with zippers for smaller items, and adjustable shoulder straps.
It measures 12 x 18 x 5 inches and is suitable for both casual and professional settings.
</p>
</div>
</body>
</html>
Explanation #
aria-describedby: Thearia-describedby="backpack-description"attribute on the<img>element links the image to the<p>element containing a more detailed description. Screen readers will read this description when the image is focused.- Detailed Context: The long description includes information about the product’s material, compartments, dimensions, and potential uses, which are essential for users who need to understand the full features of the backpack.
Example 2: Expandable Long Description with <details> and <summary>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Expandable Long Description for Product</title>
<style>
/* Basic styling for collapsible description */
.product-container {
max-width: 600px;
margin: 0 auto;
}
details {
margin-top: 10px;
font-size: 0.9em;
}
</style>
</head>
<body>
<div class="product-container">
<h2>Eco-Friendly Leather Backpack</h2>
<!-- Main image with brief alt text -->
<img src="images/backpack.jpg" alt="Brown leather backpack" width="400" height="500">
<!-- Expandable section for long description -->
<details>
<summary>View Detailed Description</summary>
<p>
This eco-friendly leather backpack is made from sustainably sourced materials. It features multiple compartments:
a padded section for laptops up to 15 inches, a front zippered pocket for easy access to small items, and
adjustable shoulder straps for comfort. The backpack measures 12 x 18 x 5 inches, making it versatile for both
professional and casual use. Available in a rich brown color, the leather is durable and has a natural finish
that adds to its appeal.
</p>
</details>
</div>
</body>
</html>
Explanation #
- Expandable Description with
<details>: The<details>and<summary>tags create an expandable area where users can choose to view the long description. - Screen Reader Accessibility: Screen readers announce the
<summary>as “View Detailed Description” and allow users to expand it for more information. This is particularly helpful for users who want more details without cluttering the page.
Example 3: Linking to an External Long Description Page with longdesc #
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Long Description with External Link</title>
</head>
<body>
<div class="product-container">
<h2>Eco-Friendly Leather Backpack</h2>
<!-- Image with a longdesc URL for full description -->
<img src="images/backpack.jpg" alt="Brown leather backpack" longdesc="backpack-description.html" width="400" height="500">
<!-- Additional link to the detailed description for non-screen reader users -->
<p><a href="backpack-description.html">Read Full Description</a></p>
</div>
</body>
</html>
Explanation #
longdescAttribute: Thelongdesc="backpack-description.html"attribute on the<img>element provides a link to a separate page with a full description. Screen readers will detect this attribute and notify the user.- External Description Link: This method is helpful if the long description is very detailed or requires significant formatting. It also allows other users to access the description by providing an additional link under the image.
Tips for Implementing Long Descriptions #
- Choose the Best Method for Your Content: Use
aria-describedbyfor short inline descriptions,<details>for collapsible content, andlongdescfor external links. - Include Key Product Details: Long descriptions should provide the necessary details to understand the image fully, such as features, materials, uses, dimensions, and colors.
- Consider User Experience: Avoid cluttering the page with long descriptions. Use collapsible sections or links to maintain a clean layout.
- Keep it Consistent: If you provide long descriptions for some images, do the same for others in the same context to create a consistent user experience.
Key Takeaways #
- Use ARIA for Linking Descriptions:
aria-describedbyandlongdescattributes make descriptions accessible to screen readers, ensuring context and clarity. - Expandable Sections for Cleaner Layout: Use
<details>and<summary>for collapsible descriptions, giving users control over what they read. - External Links for Complex Content: For very detailed images, link to an external page with a full description to keep the primary page uncluttered.
Screen reader: NVDA
Video: