Repository navigation
Media Editor: Add a placeholder state with download and copy buttons - #86490
andrewserong wants to merge 8 commits into
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: +1.18 kB (+0.01%) Total Size: 8.66 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. As a user I want to be able to add multiple close buttons so that users can close the overlay from different positions in
|
88c5a2a to
2142947
Compare
|
@fcoveram just a non-urgent heads up about this PR. I'm gradually trying to build out the remaining features of the new media editor to fill in the gaps between the core media editor screen and this new experimental one. This PR isn't very big, but is one piece: trying to create a pleasing default / preview state for those media files that cannot be previewed (e.g. ZIP files and the like). We don't need to get everything right at the outset here as this route-based approach (and previewing non image media) is still behind an experiment, but I'm hoping that we can chip away at closing the gaps in functionality in the 7.3 cycle. As always, open to any ideas / suggestions or going in a different direction with any of this 🙂 |
|
And @aduth and @ciampo I've removed you as reviewers as this PR might be a false positive for your reviewer script as this is the media editor experiment rather than changes that affect the design system. That said, also happy for your feedback if you have opinions about how the media editor experiment should look! 🙂 |
|
Tested this locally on macOS (Chrome) using
Here is a short screen recording of the test: Screen.Recording.2026-11-16.at.12.28.06.PM.mp4LGTM! Great work @andrewserong 👍 |
ciampo
left a comment
There was a problem hiding this comment.
It's still interesting to witness how DS components get used in the editor! Left a couple of comments, although I agree we shouldn't be the main reviewers here :)
| <EmptyState.Actions className="media-editor-preview__error-actions"> | ||
| <MediaPreviewFileActions | ||
| mediaUrl={ mediaUrl } | ||
| /> | ||
| </EmptyState.Actions> |
There was a problem hiding this comment.
Should these actions wrap when the canvas is narrow? EmptyState.Actions switches to a non-wrapping row at a 480px viewport, so opening Details around 600px makes the error card overflow and clips its edges.
I actually think it flagged pretty well here! Specifically, it scored high on design system patterns, since there's a "Copy to Clipboard" pattern that's relevant here. And specifically, there's some differences between the pattern's recommendations and what's implemented here:
|
|
I'm not sure this needs to be a card. Rendering an
Should the failure be a @aduth yeah good point on the styling. I think it's okay for the button to inherit styling contextually from a pattern e.g. |
…e grey canvas Drop the Card wrapper in favour of EmptyState with the folder icon for the file info, error and empty states, and hide the canvas's grey background when there's no preview. Let the actions wrap when the canvas is narrow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in a new tab Show the copy result on the Copy URL button and announce it with speak(), instead of a snackbar, and handle copy failures. Open Download in a new tab, so a cross-origin file that ignores the download attribute doesn't replace the editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Oh glad to hear it, and I'm always grateful for the extra eyes 😄. Thanks for the extra context re: design system patterns, I hadn't seen that! Will double-check in future 👍 I've pushed some updates, and copied some of the approach from #85575 for the copy behaviour. It's a little duplicative since we're copying a pattern rather than reusing a component, but hopefully it's in the overall right direction. Here's how that's looking now: 2026-11-17.15.12.39.mp4The above also ditches the grey canvas background for this placeholder state as suggested above. I've introduced the border for the sidebar to show only when we're hiding the grey canvas so that the edges are tidy for the image and video previews.
I went with the Thanks again for the feedback everyone, I think this is looking a lot better now! Happy to keep tweaking, but also this isn't an urgent PR as it's part of an ongoing experiment that's quite a long way away from being ready to land. That said, I'm enjoying building out these features and getting it in good shape as an eventual proposal for replacing the core screen. |
If you haven't already, setting up the design system's MCP server will get you this for free, since it instructs the agent to do this checking for you 😄 |
Oh that's awesome. I had not, but I have now 😄 |
I agree that And I recognize that this discussion should happen separately, and apologies to @andrewserong for derailing your pull request 😂 At the very least it turned out to be a great example of stress-testing the design system and its patterns! Recognizing that this still needs an approving review though I'm not the best to give it in terms of my familiarity with this feature, is that something that @fcoveram and/or @ramonjd could provide, or would you be alright with a best-effort review from myself? |
|
This is all still behind an experiment so happy for a best effort review, but feel free to leave this PR for now! It can happily wait for @ramonjd until he's back from AFK. (I have plenty of other things to go on with so don't worry about me feeling blocked here 😄)
I don't think you're overthinking it, and for this particular use case I think In any case the good news here is that it turns out the work that went into building out |
|
@aduth I think it's a very good point. The take-away isn't clear to me though. The design is a common pattern that clearly has use outside of empty states, but adding a new component that shares 100% functionality doesn't seem ideal, and renaming would (I assume) be a breaking change... I'll open a new issue to discuss. Edit: Opened #87142. |


What?
Part of #72734
Add a layout for the placeholder/preview state of files that cannot be previewed (e.g. ZIP files and so on).
Why?
Prior to this PR the fallback was very basic. This gives folks something more pleasing to look at, with easy to reach buttons for common tasks (download and copy link) with the filename and file size easy to see, so that it's easy to identify the file.
Download + Copy are features of the core media editor that have been missing in the new editor experiment.
How?
EmptyState)EmptyState, following a similar designTesting Instructions
Screenshots or screencast
Preview state for files (e.g. ZIP files):
Error state when a media file fails to load:
Use of AI Tools
Claude Code (Opus 5.5)