Media Editor Modal: Add a loading and simple error state#79101
Conversation
|
Size Change: +385 B (0%) Total Size: 8.46 MB 📦 View Changed
|
ramonjd
left a comment
There was a problem hiding this comment.
Nice quality of life change. Tests well for me.
Something I noticed while testing is that, if you upload a new image with an image already loaded, and click Crop very quickly, the old image loads in the image editor.
I guess the attachment hasn't yet cleared from the image block.
Nothing to do with this PR, just recording it while it's in my mind.
Cheers!
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If 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. |
|
Flaky tests detected in 9a70d11. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27323793190
|
Site logo already handles this. |
…ng, and add an alert
|
Thanks for the quick review and feedback @ramonjd! Just pushed an update that:
Happy to keep tweaking if anything still feels off! |
What?
Add a simple loading state + fade in and error state to the Media Editor Modal.
Why?
While most of the time the full image will be cached in the browser, I noticed this isn't always the case. And on slower or flaky connections (my internet is flaky today, which I think is why I noticed it!) the loading of the image can look clunky as it loads in from top to bottom with the drag handles already present.
So, this PR proposes adding a spinner, a simple fade-in when the image is loaded, and a simple error state when it fails.
These can all be expanded further in follow-ups (I know @ramonjd was previously looking at a more detailed approach to error handling), but the idea here is to try to make things feel a little smoother in a smaller iterative step.
How?
image-editordirectory with WP components, etc)Testing Instructions
To reproduce, I used Chrome Dev Tools with "Disable cache" switched on to simulate when an image hasn't already loaded. I did encounter this in real world usage, but it was intermittent, so this makes it easier to test consistently.
Switch to "Slow 4G" to test slow loading images.
Screenshots or screencast
Before (simulating a very slow connection)
2026-06-11.12.54.06.mp4
After (when quickly loading)
Even when quickly loading, hopefully it should feel smoother with this PR:
2026-06-11.12.58.31.mp4
Error state
Use of AI Tools
Claude Code