Skip to content

A11y: image_wrapper macro captions #2015

@edisile

Description

@edisile

Summary

The image_wrapper macro defined in macros/_macro-image.jinja should associate caption elements to the image

Explanation

The current implementation of the macro features an image and a caption slot, but has no way to link them to each other. The latter slot's contents are rendered inside a <p> tag, meaning that the caption will be exposed in the accessibility tree as regular text content on the page. This might confuse users that consume content through a screen reader by adding an unrelated paragraph describing an image they have no way of knowing is there.

Solution

Captions should be associated to the image they are tied to via the aria-describedby attribute. Ideally, semantic markup using <figure> and <figcaption> tags should also be used, but doing this alone wouldn't be enough because screen reader support for these tags is quite spotty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions