Repository navigation
Audio Block: Add a Media section and a setup-state toolbar option - #84605
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +138 B (0%) Total Size: 8.85 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. should give the image its context menu while selected @WebKit @Firefox in
|
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR. I'm generally in favor of this PR, but my only concern is that audio files never have thumbnails. This means it ends up looking like this:
This concern also applies to the PR for the file block. Maybe we need some kind of option to not display the thumbnail 🤔
| mediaUrl={ src } | ||
| filename={ getFilename( src ) } | ||
| allowedTypes={ ALLOWED_MEDIA_TYPES } | ||
| accept="audio/*" |
There was a problem hiding this comment.
I don't think this is needed either. Since allowedTypes is already set, MediaReplaceFlow derives the accept attribute from the allowed audio MIME types, so there's no need to add a new accept prop to MediaControl. See #84608 (comment) for details.
There was a problem hiding this comment.
Looking more widely, the same thing appears in around 14 places, Video, Audio, Playlist, Playlist Track, Post Featured Image, File, and the background image control, all passing accept alongside allowedTypes, which skips the server MIME check.
Tentative for now, but it seems like a good list to start with. Happy to open a separate PR.
Agreed on the thumbnail, following up separately with an icon fallback, since it affects Cover's video backgrounds too. Discussed on #66563. |
|
Something to consider: a file type indicator, which could be useful in DataViews contexts as well. Could be an audio icon, tiny, inside the square. There will be a future question around .md files, .pdf files, etc, but it could be a destination to aspire to. In the mean time, is there a simple way to hide the square indicator, if there's no thumbnail provided? |
|
I shared an idea in #66563 for the control handling different media types. |
|
@WordPress/gutenberg-design friendly nudge on this one: @t-hamano has approved the code side, so it just needs a quick check on the design direction. Would appreciate your feedback on this. Thanks! |
|
Looks good on my end. |
|
Thanks @jasmussen! @t-hamano, with design signed off, could you approve this one if it looks good? The Video (#84602) and File (#84608) PRs have the same change, and I've addressed your feedback on both, so they're ready for another look whenever you have time. |
|
@im3dabasia can you resolve the merge conflicts? |
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

What?
See #66563. Audio now offers media from the inspector and from the toolbar in its setup state, like Image, Cover, Media & Text and Site Logo.
Why?
1. The toolbar only appeared once audio was set, so it could replace but never add.
2. The inspector had no Media section at all.
How?
Follows #84602, which does the same for Video. Worth reviewing that one first, this is the same change applied to a near-identical file.
MediaControl, matching the blocks that already have itacceptthroughMediaControlso the sidebar restricts to audio like the toolbar does. Additive and optional, nothing changes for existing callersScreencast
Screen.Recording.2026-10-13.at.1.39.21.PM.mov
Testing Instructions
Note
The
acceptpassthrough is the same three lines as in #84602, so whichever merges second will either apply cleanly or need a one-line conflict resolution.On the duplication
Use of AI Tools
Claude Code. I reviewed and tested the change and take responsibility for it.