Conversation
A save that moves the block to a new attachment can sync that attachment's alt text and caption onto the block. The snackbar's Undo only reports the previous attachment's id and url, so it reverted the image but left the synced metadata behind. Keep the values the sync overwrote and put them back when the block returns to that attachment.
🤖 PR meta 🤖📦 Bundle sizeSize Change: +28 B (0%) Total Size: 8.1 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 testsShow the failuresSome 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. Navigates the items list via UP/DOWN arrow keys in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
I haven't tested/curated this PR yet. It's a placeholder mainly.
What?
Undoing a media editor save on the Image block now restores the block's alt text and caption, not just the image.
Why?
A save that creates a new attachment can sync that attachment's alt text and caption onto the block. The "Image edited." snackbar's Undo only passes back the previous attachment's id and URL, so the image reverted but the synced alt text and caption stayed. Restoring the original image (#81805) makes this more likely.
How?
useOpenImageMediaEditorModalkeeps the alt text and caption a save overwrote, along with the attachment the block moved away from, and puts them back when the next update returns the block to that attachment. Opening the modal clears them, so a later save back to the same attachment isn't mistaken for an Undo.Testing Instructions
Before
Kapture.2026-09-14.at.17.22.39.mp4
After
Kapture.2026-09-14.at.17.24.30.mp4