Skip to content

fix: A11y issue in play/pause of the audio player in playlist block#76035

Draft
im3dabasia wants to merge 1 commit intoWordPress:trunkfrom
im3dabasia:fix/a11y-playlist-block
Draft

fix: A11y issue in play/pause of the audio player in playlist block#76035
im3dabasia wants to merge 1 commit intoWordPress:trunkfrom
im3dabasia:fix/a11y-playlist-block

Conversation

@im3dabasia
Copy link
Copy Markdown
Contributor

What?

Prepends the action ("Play"/"Pause") to the audio control aria-label so screen readers hear the intended action plus track info.

Closes #75583

Why?

Screen readers only received track metadata and lacked the action context (play vs pause), reducing accessibility.

How?

Adds a derived state that returns "Play " or "Pause " + the track label, and binds the audio element's aria-label to it.

Testing Instructions

  1. Add a Playlist block with tracks.
  2. Start and pause playback.
  3. Verify the audio element's reads "Play …" when paused and "Pause …" when playing.

Testing Instructions for Keyboard

Tab to the play control, press Space/Enter to toggle, and confirm the aria-label updates accordingly.

Screencast

Screen.Recording.2026-03-02.at.1.29.47.PM.mov

@im3dabasia im3dabasia requested a review from joedolson March 2, 2026 08:02
@im3dabasia im3dabasia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Block] Playlist labels Mar 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Focus] Accessibility (a11y), [Block] Playlist.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions github-actions bot added the [Package] Block library /packages/block-library label Mar 2, 2026
@im3dabasia
Copy link
Copy Markdown
Contributor Author

I had a slightly older version of trunk locally and made the changes based on that. I now see that a waveform player has been included in this block, which already handles the aria-label updates mentioned in the issue, specifically, the Play and Pause states are reflected in the button’s aria-label.

I’m attaching a video for reference. I think the issue can be closed since this has already been incorporated.

Screen.Recording.2026-03-02.at.2.00.19.PM.mov

If it adds value, we could also include the track name after Play/Pause to indicate which track is being played or paused. However, this might cause repetition if the button is clicked multiple times in short intervals.

Let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Playlist [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playlist Block: Play button accessibility

1 participant