Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

Last modified 6 weeks ago

#63519 closed enhancement (reported-upstream)

Add accessibility name to core/video block using a caption

Reported by: rlautan's profile rlautan Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.8
Component: Media Keywords: needs-patch
Focuses: accessibility Cc:

Description

Background: We came across this issue when we had an external company review an entire government affiliated website for web accessibility. Aiming for WCAG 2.1 AA with a score above 80%.

A core/video block that uses a caption has no accesibility name. Adding one as a aria-label or a aria-labbeledby attribute will enhance the accessibility for the block.

Create a page and add a video block with a caption to it. Inspect the element with the accessibility tree. You will notice there is no accessible name for the video. Using VoiceOver to navigate to the video gives us no feedback and the relation between the video and caption doesn't exist.

Solution: Adding aria-labelledby to the video with a relation to the caption fixes this issue.

Extra info about figure and figcaptions, outdated but still somewhat true: https://examples.hassellinclusion.com/images/figure-figcaption01.html

Attachments (1)

Screenshot 2025-06-03 at 10.35.49.png (18.2 KB) - added by rlautan 6 weeks ago.

Download all attachments as: .zip

Change History (9)

#1 @rlautan
6 weeks ago

I added a an example of what the accessibility tree would look like if aria-labelledby was added to the video element.

#2 @shubhtoy
6 weeks ago

Thank you for bringing this up.

I tested the issue using a screen reader and found that the video caption is indeed not announced when the video receives focus. However, after adding the aria-labelledby attribute, the caption was correctly announced.

Since the core/video block is part of Gutenberg, this should ideally be addressed there. I will go ahead and raise the issue in the Gutenberg repository, referencing this ticket and providing a link once it's created.

Thanks again for reporting this!

Before

https://jodnli45mv.ufs.sh/f/RfRhkkYQhbdq74i71Hb5GdIs7H4jpKgTDScb2CeXtYyv6qnP

After

https://jodnli45mv.ufs.sh/f/RfRhkkYQhbdqfCs9iNi0r9eFbcLkV71Phg4CYR0UQEt3aMjv

edit:
The issue is raised on github here.
https://github.com/WordPress/gutenberg/issues/70297

Last edited 6 weeks ago by shubhtoy (previous) (diff)

#3 @rlautan
6 weeks ago

You're welcome and thank for you directing this to the right place. I'll make sure to think of that next time I raise an issue like this.

For now I've fixed the issue by using the 'render_block_core/video'-hook to add the aria-labelledby attribute with the excellent WP_HTML_Tag_Processor.

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


6 weeks ago

#5 @nikunj8866
6 weeks ago

  • Keywords needs-patch added

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 137.0.0.0
  • OS: Windows 10/11
  • Theme: Fondasi 1.2.1
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).
  2. 🐞 Bug occurs. Focus is not set on the caption field when the error occurs.

Supplemental Artifacts

https://screenrec.com/share/1vbaIFX0zj

Last edited 6 weeks ago by nikunj8866 (previous) (diff)

This ticket was mentioned in Slack in #core-test by nikunj8866. View the logs.


6 weeks ago

#7 @wildworks
6 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

#8 @wildworks
6 weeks ago

This issue should be resolved in the Gutenberg repository. Let's close this ticket and continue the discussion on GB 70297.

Note: See TracTickets for help on using tickets.