-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Describe the image in the featured image preview #14416
Comments
Hi @afercia I found the default alt text of the image is empty string. Even if I add alt text in the image-modal, the html still shows alt is empty (see below image)
![]() |
@Jackie6 yes, but the alt text wouldn't help in this case. As mentioned above, the entire content is overridden by the aria-label on the button. We need to put some meaningful text in the aria-label. gutenberg/packages/editor/src/components/post-featured-image/index.js Lines 56 to 70 in c619130
|
@afercia Hi Andrea, I have created a pull request to fix the issue. I am not sure what is the best way to get the file name of the image. Because in the API documentation, there is no name or tile. So I just use the |
## Description Related in #14416 we have a similar issue but for the featured image that issue is being addressed on #14593. Here the solution is not as perfect, as we don't have the alt text of the poster image only the URL was saved in the attributes. ## How has this been tested? I used the voice over utility and I checked that a descriptive message is announced after the select/replace poster image button gains focus.
…14752) ## Description Related in WordPress#14416 we have a similar issue but for the featured image that issue is being addressed on WordPress#14593. Here the solution is not as perfect, as we don't have the alt text of the poster image only the URL was saved in the attributes. ## How has this been tested? I used the voice over utility and I checked that a descriptive message is announced after the select/replace poster image button gains focus.
This was reported a few days ago also on the WordPress Trac. See https://core.trac.wordpress.org/ticket/49651 |
Just opened a PR for this on #24888 👍 |
The related Trac ticket was one of the tickets the accessibility team milestoned for WordPress 5.5. The accessibility team would need some help (we did ask for help) to help this issue move on 🙂 Setting the milestone to WordPress 5.6. for visibility. |
When a featured image is set, a preview is displayed within a button. Pressing the preview button opens the media modal to replace the image.
The preview button has an
aria-label="Edit or update the image"
which gives the correct information to assistive technology users.However, there's no indication of what the set image is. All users need to know which image is set, including assistive technology users.
In this case, it's not possible to use the
alt
attribute because the entire content of the preview button is overridden by thearia-label="Edit or update the image"
. A possible solution is anaria-describedby
attribute on the button to target a visually hidden description.The description should contain some meaningful text:
Current image: altText
The current image has no alternative text. The file name is: fileName
Note: the second text is the same currently used in core for the media widgets.
This way, the whole preview would be announced, for example, this way:
The text was updated successfully, but these errors were encountered: