Make WordPress Core

Opened 6 months ago

Closed 5 months ago

#63800 closed defect (bug) (invalid)

Image Block: Alt Text resets when replacing image in block

Reported by: rahultank's profile rahultank Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords: close
Focuses: accessibility Cc:

Description

Steps to reproduce:

Create a new post or page.

Add an Image block.

Upload an image.

In the Block Settings sidebar, enter custom Alt Text (alternative text).

Without deleting the block, click Replace → Open Media Library and choose a different image.

Observe the Alt Text field.

Expected behavior:
The Alt Text field should remain unchanged until the user manually edits or clears it.

Actual behavior:
When replacing an image inside the same block, the Alt Text resets to blank.

Attachments (3)

afterreplace.png (325.4 KB) - added by rahultank 6 months ago.
before-replae.png (299.1 KB) - added by rahultank 6 months ago.
Screenshot.png (398.2 KB) - added by rahultank 6 months ago.

Download all attachments as: .zip

Change History (9)

@rahultank
6 months ago

#1 follow-up: @audrasjb
6 months ago

  • Version 6.8.2 deleted

In my opinion, this would be an expected behavior.
Indeed, when an image is replaced, there is a strong chance that the best alt text for the new image won't be the same one than with the previous one.

Of course, we could keep the alt text unchanged, but in this case we should also add a "don't forget to verify your alt text" heads up message, which sounds overkill to me :)

#2 in reply to: ↑ 1 @sabernhardt
6 months ago

In my opinion, this would be an expected behavior.

I agree.

One case where the first alt text could also fit the replacement is if the image has a custom link, because then the alternative text would describe the link target. However, using the Replace feature also removes custom links.

When replacing an image inside the same block, the Alt Text resets to blank.

The sidebar field would reset to blank if the image in the library has blank alt text, but any alternative text assigned to the new image in the library would be inserted in the block (and its sidebar settings).

#3 @audrasjb
6 months ago

  • Keywords close added

Adding close keyword, but waiting for reporter feedback before eventually closing it.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


6 months ago

#5 @joedolson
6 months ago

This seems very use-case specific. In some contexts, replacing an image could need to retain the same alt text, but there's an equal or greater chance that you'll need a different alt text.

I think that this needs to remain the author's responsibility to verify and address alt text; there's no programmatic option we could pick that would be reliably "correct", so it's best to consistently use the alt text that's currently stored with the image.

I'll leave this open for a few days if @rahultank has any additional follow-up, but I don't think this is something we're likely to change.

#6 @joedolson
5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

With no further feedback, I'm going to go ahead and close this issue as invalid, since this works as intended.

Note: See TracTickets for help on using tickets.