WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 months ago

Last modified 3 months ago

#34595 closed defect (bug) (fixed)

Add aria-describedby to improve image/caption relationship

Reported by: joedolson Owned by: joemcgill
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch
Focuses: accessibility Cc:

Description

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 3 years ago.
Adds aria-describedby to captioned images

Download all attachments as: .zip

Change History (30)

@joedolson
3 years ago

Adds aria-describedby to captioned images

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


3 years ago

#2 @joedolson
3 years 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.


2 years ago

#4 @afercia
2 years 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.


16 months ago

#6 @afercia
16 months ago

  • Milestone changed from Future Release to 4.8

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

#7 @joedolson
16 months ago

  • Status changed from assigned to accepted

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


13 months ago

#9 @juliemoynat
13 months ago

For information, in our French accessibility reference "RGAA" based on WCAG, we have to give "figure" tag a "role='group'" attribute.

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


12 months ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


12 months ago

#12 @joemcgill
12 months ago

  • Milestone changed from 4.8 to 4.8.1

Lets move this to 4.8.1 per @afercia's suggestion in Slack.

#13 @desrosj
12 months ago

  • Keywords needs-refresh removed

Patch still applied cleanly for me.

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


12 months ago

#16 @joemcgill
11 months ago

  • Milestone changed from 4.8.1 to 4.9
  • Owner changed from joedolson to joemcgill
  • Status changed from accepted to assigned

Moving this to 4.9 for review.

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


10 months ago

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


8 months ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 months ago

#20 @jbpaul17
7 months ago

  • Milestone changed from 4.9 to 4.9.1

Per discussion in today's 4.9 bug scrub, we're punting this to 4.9.1.

#21 @johnbillion
6 months ago

  • Milestone changed from 4.9.1 to 5.0

#22 @SergeyBiryukov
3 months ago

In 42690:

Media: Convert concatenation in img_caption_shortcode() to sprintf() for clarity.

See #34595.

#23 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 42691:

Media: Add aria-describedby to img_caption_shortcode() output to improve image/caption relationship.

Props joedolson.
Fixes #34595.

#24 @SergeyBiryukov
3 months ago

In 42692:

Media: Make sure $caption_id does not depend on an undefined variable.

See #34595.

#25 @SergeyBiryukov
3 months ago

In 42693:

Media: Only add aria-describedby in img_caption_shortcode() if a non-empty attachment ID attribute was provided.

See #34595.

#26 @SergeyBiryukov
3 months ago

In 42694:

Media: After [42693], update HTML4 markup in img_caption_shortcode() to avoid an empty ID attribute as well.

Add a unit test for aria-describedby in img_caption_shortcode().

See #34595.

#27 @SergeyBiryukov
3 months ago

In 42704:

Media: Pass original attribute values to img_caption_shortcode_width filter instead of markup pieces.

Add caption_id to the list of documented [caption] shortcode attributes.

See #34595.

#28 @SergeyBiryukov
3 months ago

In 42705:

Docs: Use code formatting for tags in img_caption_shortcode() DocBlock.

See #34595.

#29 @SergeyBiryukov
3 months ago

In 42706:

Media: In img_caption_shortcode(), make sure $id and $caption_id are always defined.

See #34595.

Note: See TracTickets for help on using tickets.