-
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
Media & text block: The Alt text for the featured image is not working correctly #60023
Comments
@draganescu Hi, I am pinging you to ask for your continued help with this featured image feature. I have not been able to fully solve this issue. I can solve it partially by not using the alt text from the media library for the featured image. But then there are inconsistencies because it does not match how the alt text works for regular images. |
Is this something that plagues the other "use featured image" enabled blocks (like cover)? Does the featured image block work? |
Cover and featured image blocks do not have alt text options. |
I confirmed the approach you are trying in #60029. One thing to consider is that this block may be used inside a template or query loop block. For example, when used in a Single template, I don't think the alt text should be editable because the featured image changes dynamically depending on the post. Also, if it is inside a Query Loop block, I think the
In my opinion, it's better to just solve this problem first. In other words, similar to the Featured Image block, if "Use featured image" is enabled, the alt text control will be hidden, and the front end will always output the alt attribute of the media itself. After that, we can explore approaches to make the alt text editable from a broader perspective, that is, the three blocks of the Featured Image block, Cover block, and Media & Text block, taking templates and query loop into consideration. |
This, I find this to be a predictable and good enough path. |
Yes, it is not great, but I had the same thought. |
Part of me wonders if we should fix the root problem here vs. adding a band-aid. Lots of work involved? |
I think so. Because the featured image changes dynamically depending on the context, Alt text data cannot be stored in the block markup or the comment delimiter. I think one approach would probably be to save it as a post meta with the definition "Alt text of the featured image in this post". I think this requires a lot of experimentation and verification. |
CC: @joedolson for any final feedback. |
There is one more known issue that will need to be fixed besides removing the alt text option and fixing the missing link. |
Description
When the Media & text block uses a featured image, the alt text is:
Step-by-step reproduction instructions
With Gutenberg active:
Create a new post and assign a featured image that has an alt text in the media library.
Add a Media & text block and select the option "Use Featured image".
Try to change the text in the block settings panel.
Save and reload the post.
Confirm that the alt text does not include the changes you made.
View the source of the block on the front of the site and confirm that there is no alt text output.
Screenshots, screen recording, code snippet
No response
Environment info
Gutenberg current trunk.
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: