Make WordPress Core

Opened 8 months ago

Closed 2 months ago

Last modified 2 months ago

#63895 closed defect (bug) (fixed)

Accessibility: Alt Text Metadata is not imported but Description is

Reported by: jhmonroe's profile jhmonroe Owned by: audrasjb's profile audrasjb
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch has-unit-tests commit needs-dev-note add-to-field-guide
Focuses: accessibility, administration Cc:

Description (last modified by sabernhardt)

Originally posted to GitHub: GB71395

Accessibility issue:
When you upload an image that has existing metadata for description and alt text, the description is automagically added to the image block as the caption, but the alt text is ignored.

I am working with clients using assistive technology who know how to add metadata to images, and this would save them a step of needing to navigate the block editor so much if their metadata is imported correctly and more fully!

(Presumably this is some issue with updating content in the right sidebar versus in the block you're inserting which requires no refresh)

Only semi-related issue I found was this: GB66491

Step-by-step reproduction instructions

  • add metadata to an image in both description and alt text fields
  • upload image to an image block
  • watch the caption populate from description but alt text is not added in right sidebar

Screenshots, screen recording, code snippet

Metadata for description and alt text added in Adobe Bridge:

metadata placed on file, using the same text for Description and Alt Text

Description appears as caption, nothing shows in metadata:

screenshot showing description coming thru as caption but alt text being ignored

Attachments (5)

Screenshot 2025-08-28 at 6.55.30 PM.png (644.2 KB) - added by jhmonroe 8 months ago.
screenshot showing metadata placed on file
Screenshot 2025-08-28 at 6.56.30 PM.png (1.3 MB) - added by jhmonroe 8 months ago.
screenshot showing description coming thru as caption but alt text being ignored
Screenshot 2025-08-29 at 12.04.51 AM.png (252.4 KB) - added by jhmonroe 8 months ago.
screenshot showing the same result, but viewed in media library
meme after uploading.png (3.4 MB) - added by adamsilverstein 8 months ago.
test image after uploading with mini plugin enabled
Capture d’écran 2026-03-06 à 15.04.44.png (203.1 KB) - added by audrasjb 2 months ago.
missed props

Change History (45)

@jhmonroe
8 months ago

screenshot showing metadata placed on file

@jhmonroe
8 months ago

screenshot showing description coming thru as caption but alt text being ignored

@jhmonroe
8 months ago

screenshot showing the same result, but viewed in media library

#1 @rishabhwp
8 months ago

I was going through this ticket and noticed that ticket #55535 seems to be closely related and could offer useful context. Adding it here for reference.

#2 @jhmonroe
8 months ago

@rishabhwp thank you for sharing! i looked thru a few pages of tickets after searching for alt text and this didn't come up.

it's an interesting record of some of the things the accessibility team considered.

ultimately if they decide they don't want existing alt text to auto-populate, it will be useful for me to have some explanations to give my blind clients on why a more tedious path was chosen for them (where they have to do something twice in this case)

@mmzeroexpcom comments there are especially interesting. as are @Jesterman about why we should not make people do work twice that they're already done, especially if those people are blind and we're creating more work for them to navigate menus, blocks, etc. If someone has gone thru the trouble to add alt text metadata once, we should honor that.

#3 @audrasjb
8 months ago

  • Version 6.8.2 deleted

#4 @adamsilverstein
8 months ago

Based on the discussion in #55535 I don't know if this is planned, I'm curious what @joedolson thinks. If this isn't planned, we can go ahead and close these tickets.

In the meantime, I created a mini plugin based on the code provided in #55535 by @pbiron. This plugin will extract the alt meta data and insert it automatically into the Alt field in the media library.

Plugin: https://gist.github.com/adamsilverstein/e9c9993d938eae80e559d9eda8c0fdcc

Instructions for installing a Gist mini plugin: https://gist.github.com/westonruter/6110fbc4bef0c4b8c021a112012f7e9c

#5 @adamsilverstein
8 months ago

@jhmonroe can you give this plugin a test, it worked in my testing - however I only tested the single image provided. If this works for you you could install it as an mu plugin on your client's sites.

@adamsilverstein
8 months ago

test image after uploading with mini plugin enabled

#6 @jhmonroe
8 months ago

@adamsilverstein thanks for this! Can confirm it works

The only error it causes for me is the following when I don't have a title added:

Warning: Undefined array key "title" in /Users/[my-username]/Local Sites/blanksite/app/public/wp-admin/includes/media.php on line 395
103

If it's this minimal, would be great to have this feature in the media library core uploader! #55535 should def consider

#7 @joedolson
8 months ago

It's definitely still under consideration; it's on the agenda for the accessibility team meeting this Thursday.

#8 @adamsilverstein
8 months ago

Thanks @joedolson!

My main goal with the plugin besides providing a stop-gap solution was to get some wider testing of the code to make sure it worked with a variety of images. If you do decide to add this to core, I am happy to help contribute the code or review.

@jhmonroe I would appreciate any additional manual testing you can do with various images to see if any other issues come up in your testing.

The only error it causes for me is the following when I don't have a title added:
Warning: Undefined array key "title" in /Users/[my-username]/Local Sites/blanksite/app/public/wp-admin/includes/media.php on line 395

can you please provide a sample image that throws this error when uploaded? this will help me debug the issue.

#9 @jhmonroe
8 months ago

Hi @adamsilverstein here's the image in question. I only added a description and alt text since those were the fields I was concerned with for clients. So perhaps your plugin simply needs a way to ignore fields that aren't present. Guessing it was only looking for description, alt text, and title?

https://www.dropbox.com/scl/fi/1rob8ro4p2d9m2txrdhju/1Cottekill-1024px-Metadata4.jpg?rlkey=smextxn491atx6chyfx7bg0su&dl=0

@joedolson thank you!

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


8 months ago

#11 @joedolson
8 months ago

  • Owner set to sajjad67
  • Status changed from new to assigned

To assess the risk of this, we're going to review how the alt text metadata fields are used by major image creation and sourcing services. The major risk in adding this is if image creators or sharing services are mis-using the metadata field, e.g., adding branding or other meaningless non-content into the field. If that is the case, then importing that data would make automated detection of missing alternative text considerably harder. Right now, with the default being empty, it's very easy to find which images need alternative text. If a lot of images import bad information, then that becomes difficult.

@sajjad67 is going to go through the major image editors and sources and see if there's anything they do that would be a point of concern, so that we can go into this with good information about the possible consequences.

#12 @sabernhardt
8 months ago

  • Description modified (diff)

#13 @sajjad67
8 months ago

For our first phase testing, I’ve shortlisted the following tools and resources:

Photo Editing Softwares

  1. Photoshop (Already Have)
  2. Lightroom (Already Have)
  3. Canva (Already Have)
  4. GIMP (Already Have)
  5. Photopea (Already Have)
  6. DxO PhotoLab
  7. Capture One Studio
  8. Affinity Photo
  9. Luminar Neo
  10. Figma (Already Have)

Stock Photo Websites

  1. Shutterstock
  2. Adobe Stock
  3. Getty Images
  4. iStock
  5. Depositphotos (Already Have)
  6. Alamy
  7. Stocksy
  8. Envato Elements (Already Have)
  9. Pexels (Already Have)
  10. Unsplash (Already Have)

AI-Generated Image Platforms / Tools

  1. DALL·E (Already Have)
  2. MidJourney (Already Have)
  3. Stable Diffusion (Already Have)
  4. Adobe Firefly
  5. Runway Gen-2
  6. Leonardo AI (Already Have)
  7. NightCafe (Already Have)
  8. Fotor AI (Already Have)
  9. Artbreeder
  10. Canva AI Image Generator (Already Have)

If anyone already has a subscription to any of the above tools or platforms, it would be great if you could share a test image generated through them. I currently don’t have access to all subscriptions, so any contributions here would help speed up testing.

Last edited 8 months ago by sajjad67 (previous) (diff)

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


8 months ago

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


7 months ago

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


7 months ago

#17 @sajjad67
7 months ago

I have completed a review of the following external image sources and tools to check whether they add any default alt descriptions to images on export or download.

Photo Editing Software

  • Photoshop ✅
  • Lightroom ✅
  • Canva ✅
  • GIMP ✅
  • Photopea ✅
  • Figma ✅

Stock Photo Websites

  • Depositphotos ✅
  • Envato Elements ✅
  • Pexels ✅
  • Unsplash ✅

AI-Generated Image Platforms / Tools

  • DALL·E ✅
  • MidJourney ✅
  • Stable Diffusion ✅
  • Leonardo AI ✅
  • NightCafe ✅
  • Fotor AI ✅
  • Canva AI Image Generator ✅

Findings:
After testing all of the above, none of these applications, stock photo providers, or AI image generation platforms include any default alt description or accessibility metadata (AltTextAccessibility) in the exported/downloaded images.

So far, there appears to be no external source that automatically provides usable alt text at image creation or download.

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


7 months ago

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


6 months ago

#20 @joedolson
6 months ago

  • Milestone changed from Awaiting Review to 7.0

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


4 months ago

#22 @JeffPaul
3 months ago

<following>

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


2 months ago

@joedolson commented on PR #11135:


2 months ago
#25

@adamsilverstein I added a couple additional checks to protect against images with no XMP data or with invalid XML between the points, but there are probably other things that can be done here.

#26 @joedolson
2 months ago

  • Keywords needs-testing needs-unit-tests added

#27 @joedolson
2 months ago

To test:

#28 @ozgursar
2 months ago

Patch Testing Report

Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11135
Plugin Tested: https://gist.github.com/adamsilverstein/e9c9993d938eae80e559d9eda8c0fdcc

Environment

  • WordPress: 7.0-beta2-61752-src
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 145.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Extract Alt on Upload 1.0.0
    • Test Reports 1.2.1

Steps taken

  1. Create a blank post
  2. Add the provided Sponge Bob image that contains embedded data
  3. Check if alt text field captures the embedded description
  4. Without patch or plugin description is not captured.
  5. Apply patch and repeat the steps
  6. ❌ Patch is failing (with PR 11135 alt text field still doesn't capture the description)
  7. Remove patch, install plugin by @adamsilverstein and repeat the steps
  8. ✅ Plugin is solving the problem

Expected result

  • When an image with embedded description is uploaded, alt text field captures the data during upload

Additional Notes

  • I used the online XMP editing tool https://metaeditor.picvario.com/ and tried a few images with various fields XMP data and plugin was able to capture the description properly each time.

Screenshots/Screencast with results

Before
https://i.imgur.com/I8dietJ.png

After
https://i.imgur.com/0eCioQu.png

Last edited 2 months ago by ozgursar (previous) (diff)

#29 @joedolson
2 months ago

Thanks for testing @ozgursar! I've updated the PR to include handling this in the REST Controller, which is needed for this to work in the editor.

#30 @joedolson
2 months ago

  • Keywords has-unit-tests added; needs-unit-tests removed

#31 @audrasjb
2 months ago

Hi from WordCamp Nice contributor day Accessibility table! We're going to test this PR to make sure it works on various environments :)

@valentingrenier commented on PR #11135:


2 months ago
#32

Just tested to import an image with "toto" as alternative text. The text is correctly retrieved and imported in the media library.

## Config

OS : MacOS
WP: 7.0-beta2-20260305.033903

## Image to test

https://github.com/user-attachments/assets/4fd905db-47eb-4f59-80e5-723979f06d4c

## Video screenshot

https://github.com/user-attachments/assets/93e4fd33-bcf1-4fa4-86ca-1ca6521463a2

@louischan commented on PR #11135:


2 months ago
#33

Just tried it and i seems to work correctly.

Steps I followed:

  1. I created the alt text meta data using an online tool (https://metaeditor.picvario.com/).
  2. I launched WordPress Playground with the pull request
  3. I imported the image in the media library (file attached below)
  4. The alt text is correctly imported.

https://github.com/user-attachments/assets/8e2c79b6-8a92-47b0-ae6a-ec9587797e6c

Environment:
Fedora Linux 43 (Workstation Edition)
WordPress development version (7.0-beta2-20260305.033903)

padrian-06 commented on PR #11135:


2 months ago
#34

Test - WP Contributor day (Nice)

CONTEXT

  • OS : MacOS
  • WP : 7.0-beta2-20260305.033903
  • img attached got ALT = testing-alt

https://github.com/user-attachments/assets/0b02b520-390c-4902-8de4-b28b28428a63

TEST

SCREENCAST : https://jam.dev/c/918877cc-06c3-4be7-ad06-43f8d12dc526

RESULT

The alternative text appears in the media library in "Alternative Text" field

mathias7am commented on PR #11135:


2 months ago
#35

Tested to import an image with alternative text. The text is correctly retrieved and imported in the media library.

  • Context *

OS : Win11
Browser : Firefox
WP: 7.0-beta2-20260305.033903

Original file with alternative text
![Uploading 19166f6ddd4810dc4.20311294.jpeg…]()

Snapshot
![Uploading Screenshot 2026-03-05 at 10-29-30 WordPress Playground.png…]()

#36 @audrasjb
2 months ago

  • Keywords commit added; needs-testing removed
  • Owner changed from sajjad67 to audrasjb
  • Status changed from assigned to accepted

We have 4 successful tests on various environments, so it looks like this patch is good to ship. I'm self assigning this ticket for final review and commit.

#37 @audrasjb
2 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 61841:

Media: Import images Alt text IPTC metadata.

This changeset introduce a new wp_get_image_alttext() function that extracts Image Alt text metadata from image IPTC metadata.

Props jhmonroe, rishabhwpn, adamsilverstein, sajjad67, ozgursar, joedolson, audrasjb, huzaifaalmesbah, sabernhardt, valentingrenier, louischan, penelopeadrian, mathiaspeguet.
Fixes #63895.

#38 @audrasjb
2 months ago

In 61842:

Media: Add the missing unit test image after [61841].

See #63895.

#39 @audrasjb
2 months ago

  • Keywords needs-dev-note add-to-field-guide added

I'll put together a small paragraph to describe this changeset in the Misc Changes dev note.

#40 @audrasjb
2 months ago

Just noting that all the missed props from the other ticket have been added manually to this commit. Thanks @joedolson for spotting this.

Note: See TracTickets for help on using tickets.