-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Image block: caption persists when replacing image #62468
Comments
I think this is because there's a process to ensure that caption text isn't overwritten by an empty caption. gutenberg/packages/block-library/src/image/edit.js Lines 197 to 203 in fe8fe40
Do you think this process is unnecessary? |
I understand the intent of that check but seems to me it is based on an assumption. To me, it is only valid in a scenario where the user has written a new caption and it is still making a decision on what image to use or wants to replace the image with one that fits with the existing caption. Maybe they are trying various images and in that case it makes sense to not lose the caption. But this is an assumption on a single case. As a user, when I replace an image with a new one that has its own caption, I expect the caption to be there. Edit: Also, comparing the behavior with the one that always existed in WordPress and now it's in the Classic editor, this is a change in the expected behavior that should have been considered a little more deeply IMHO. |
This is my take as well. If I replace an Image block that already has a set caption (in the media library), I'd expect that to replace the one of the image i was using previously. |
I think this is already the case: 9dc4036c748b68e342e870683a9aa970.mp4I think the point here is whether to keep the previous caption if the caption of the newly replaced image is empty, or to make it empty. By the way, in the classic editor, it seems that the caption of the replaced image always takes priority, regardless of whether the caption is empty or not. f260eb9a14a464ad7e398b1fd4d4c7e5.mp4 |
Contrary to this issue, it is also worth noting that some users consider the caption being replaced with the new image's caption to be a bug. |
Found another related issue - #42834. I think we need to consolidate these into a single issue and agree on some 80/20 behavior and implement it. |
Thanks for pointing me to another issue. Let's close this issue and continue the discussion in #42834. |
Description
When replacing an image that does have a caption with another image that does not have a caption, the previous caption persists.
I can reproduce thie behavior on WordPress 6.5 and on Gutenberg trunk.
Attached animated GIF to illustrate:
Step-by-step reproduction instructions
Note: when replacing with an image that does have a caption, the caption is correctly updated.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: