#57893 Add 'Use empty alt text' option for Post Featured Image block#68569
#57893 Add 'Use empty alt text' option for Post Featured Image block#68569dhananjaykuber wants to merge 3 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| <ToggleControl | ||
| __nextHasNoMarginBottom | ||
| label={ __( | ||
| 'Use empty alt text (decorative image)' |
There was a problem hiding this comment.
I think this text is too long and that the parentheses should be removed.
carolinan
left a comment
There was a problem hiding this comment.
Thank you for working on this.
I want to make the following change request:
The alt text should also be removed from the block in the editor when the option is enabled.
The failing test needs to be solved, the test fixtures need to be regenerated. Try npm run fixtures:regenerate
|
Hi @carolinan I have updated the label and also tried to resolve the test using |
|
To be honest, I struggle a bit with this feature here 🤔 The issue that worries me is that the featured image block is almost never used in isolation on a single post. Instead the block gets used on single templates and inside query loops. So in both of these scenarios we are not talking about a single featured image for a specific block but rather the generalized concept of a featured image inside a template. Any setting you apply to the featured image block will be applied to all posts / all featured images. Knowing that I'm a little worried that the feature will get enabled by folks who want to set it for a single image only. But in doing so they have now removed the alt text from all featured images everywhere. |
|
I know why there is no alt text option for the block, but the lack of an option to enter a custom alt text also makes this option feel awkward.
Yes this is the case with styling options like borders. Users who are not aware of it may find it unexpected the first time they are using it, but will then learn.
Would it help if the current alt text was visible in the sidebar but not editable? |
|
Would changing the help text depending on the context be a solution? For example: Default / Post Editor: When child of Query Loop: Template Editor: |
Fixes #57893
What?
Adds the ability to set empty alt text (alt="") for decorative images in the Post Featured Image block by introducing a new toggle control in the block settings.
Why?
Currently, there is no way to set empty alt text (alt="") for the Featured Image block when the image is purely decorative. While it's possible to remove alt text in the media library, this is a global solution that affects the image everywhere it's used. This enhancement allows setting empty alt text specifically for the Featured Image block context, improving accessibility by properly indicating decorative images to screen readers.
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
screen-capture.3.mp4