Can you provide alternative text for table content in DITA?
In DITA, alternative text for table content can be provided using the alt attribute on elements that include images. Alternative text (alt text) serves as a textual description of the image or other non-text content within a table, ensuring that this information is accessible to individuals who rely on screen readers or assistive technologies.
The alt attribute is commonly applied to elements like <image>, <object>, and <link>, which may include images, multimedia, or links to non-text content. This attribute provides a brief and meaningful description of the content for users who cannot see the visual representation. It is especially important for users with visual impairments.
Using the attribute involves two core principles: meaningful descriptions and handling empty cells.
Meaningful Descriptions
When providing alternative text, it should be concise yet informative. Describe the content and its purpose in a way that conveys the same information as the visual element. Avoid using vague descriptions like “image123” or “placeholder.”
Handling Empty Cells
If a table cell contains only an image with no accompanying text, consider providing empty alt attributes or using an appropriate indicator (e.g., “Blank” or “Image”) to indicate the absence of textual content.
Example
<table>
<tgroup cols="2">
<colspec colname="col1" colnum="1" colwidth="1*"/>
<colspec colname="col2" colnum="2" colwidth="1*"/>
<tbody>
<row>
<entry>Product Description</entry>
<entry>
<image href="product_image.jpg" alt="Product X - A versatile tool for various tasks"/>
</entry>
</row>
</tbody>
</tgroup>
</table>
In this example, the <image> element includes the alt attribute with a meaningful description of the product image, ensuring that users relying on screen readers can understand the content and its purpose.