Skip to content
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

Block Inserter > Media > Generate images does not add alt text or title #729

Open
1 task done
jeffpaul opened this issue Feb 22, 2024 · 3 comments
Open
1 task done
Assignees
Labels
BLOCKED type:bug Something isn't working.
Milestone

Comments

@jeffpaul
Copy link
Member

Describe the bug

When generating an image via the media modal, the prompt is added as the Alternative Text field and a hyphenated version is set for the Title field. However when generating via the Block Inserter > Media > Generate images flow we're not properly putting the prompt into the Alternative Text field or setting that as the hyphenated version in the Title field.

Steps to Reproduce

See above

Screenshots, screen recording, code snippet

Block Inserter > Media > Generate images:
Screenshot 2024-02-22 at 4 09 21 PM

Generated image in Media Library showing no Alternative Text and generic Title:
Screenshot 2024-02-22 at 4 09 43 PM

Environment information

Device: Mac mini 2018
OS: macOS Sonoma 14.3.1
Browser: Firefox 122.0.1

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jeffpaul jeffpaul added the type:bug Something isn't working. label Feb 22, 2024
@jeffpaul jeffpaul added this to the 3.1.0 milestone Feb 22, 2024
@Sidsector9 Sidsector9 self-assigned this Apr 1, 2024
@Sidsector9
Copy link
Member

@dkotter I couldn't find a way to fix this. Via the media modal, we set the file name which is used as the title and the alt text, but via the Block inserter > Generate images, the file name is set to image.png by core. This behaviour is consistent with Openverse as well.

title: search,
url: `data:image/png;base64,${ item.url }`,
previewUrl: `data:image/png;base64,${ item.url }`,
id: undefined,
alt: search,
caption: classifaiDalleData.caption,

The fields above are used when inserting the image block, but they are not submitted to the server-side when creating an attachment. Not sure if this is intentional by WP Core, do you suggest we raise a ticket?

@dkotter
Copy link
Collaborator

dkotter commented Apr 1, 2024

Yeah, I spent a little time looking at this when the issue was first opened and basically came to the same conclusion. Seems we're doing what we're supposed to here but Core isn't using the values we supply when the image is actually imported (it uses the title and alt text when rendering the preview image only).

I'd suggest seeing if there's an open issue in the Gutenberg repo (knowing it's not always easy finding things with the amount of issues there) and if there isn't an open one, we can open a new one.

@Sidsector9
Copy link
Member

Opened an upstream feature request - WordPress/gutenberg#60378

@dkotter dkotter modified the milestones: 3.1.0, 3.2.0 Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLOCKED type:bug Something isn't working.
Projects
Status: To Do
Development

No branches or pull requests

3 participants