Make WordPress Core

Opened 18 months ago

Last modified 3 months ago

#34595 accepted defect (bug)

Add aria-describedby to improve image/caption relationship

Reported by: joedolson Owned by: joedolson
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch needs-refresh
Focuses: accessibility Cc:


See also #27402, where we added aria-describedby to gallery output. Probably should have thought to deal with captioned images at the same time!

Currently, there's minimal semantic relationship between the caption and the image, and none that will reliably be recognized by assistive technology. In theory figure and figcaption should provide a relationship, but this doesn't have adequate support.

In the HTML mode, no relationship exists at all. In HTML mode, I have doubts about the method to add aria-describedby used in this patch; str_replace feels dirty, but it would be backwards-compatible, where adding aria-describedby to the img element at input would only effect future images. In HTML4 mode, the relationship has to be between the img and the description, not the container, as in the figure relationship.

Attachments (1)

34595.patch (1.5 KB) - added by joedolson 18 months ago.
Adds aria-describedby to captioned images

Download all attachments as: .zip

Change History (8)

18 months ago

Adds aria-describedby to captioned images

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.

18 months ago

#2 @joedolson
18 months ago

An alternate approach could be to use role='group' for this relationship. I'm not sure I like the approach, but could be convinced.

WAI on role=group: http://www.w3.org/WAI/tutorials/images/groups/#a-collection-of-images
Drupal ticket on this issue: https://www.drupal.org/node/2509700

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.

10 months ago

#4 @afercia
10 months ago

  • Keywords needs-refresh added; dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to joedolson
  • Status changed from new to assigned

'aria-describedby' looks simpler and effective, also for consistency with the gallery. Moving to future release and assigning @joedolson :) Probably needs a refresh.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.

3 months ago

#6 @afercia
3 months ago

  • Milestone changed from Future Release to 4.8

Moving to 4.8 as discussed in today's accessibility meeting.

#7 @joedolson
3 months ago

  • Status changed from assigned to accepted
Note: See TracTickets for help on using tickets.