-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Alt and caption text written on images while the image was temporary is deleted. #16051
Fix: Alt and caption text written on images while the image was temporary is deleted. #16051
Conversation
const { id, url, alt } = this.props.attributes; | ||
// If the current image is temporary but an alt text was meanwhile wrotten by the user, | ||
// make sure the text is not overwritten. | ||
if ( alt && isTemporaryImage( id, url ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also take care of the caption
here so that this can also close #16746 .
86b3eea
to
f5a01f2
Compare
Hi @epiqueras, thank you for reviewing this PR! The PR was rebased and updated to also deal with the caption. |
f5a01f2
to
b5e62ef
Compare
The suggestion was applied.
…ted when the upload finishes.
b5e62ef
to
b92780e
Compare
…ted when the upload finishes. (#16051)
…ted when the upload finishes. (#16051)
This issue had been solved but I am seeing it just cam back when using Gutenberg 8.3.0 (this is not happening with the current core version of the block editor only if the plugin is active). I was also able to reproduce this on a WordPress.com simple site. |
Fixes: #12202, #16746
Currently, the image alt text written while the image is temporary (points to a blob URL) is deleted as soon as the upload finishes.
This PR fixes the problem.
Alt attribute is not set when the upload is complete if the current image is temporary and an alt already exists.
Description
How has this been tested?
(to make the upload slow I used chrome dev tools network throttling)
I added an image block, I pressed the upload button, while the image is uploading I wrote some alt text. I verified that the al text was persisted when the upload finished.
I repeated the same test but instead of adding an image block I drag&dropped an image directly to the editor.
I added an image I wrote some alt text. I drag & dropped another image to replace the current image, I waited for the upload to complete and I verified the alt text was removed.