Add an alt attribute to the linked featured image if there is no post title #46830
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
In #41077 it was reported that when a post or page has no title,
but has a linked featured image, there is no link text. This issue only affects the front, not the editors.
This PR adds an alt attribute to the post featured image if it is linked and the post title is missing.
The new alt text is "Untitled post" followed by the post id.
Why?
The missing link text is an accessibility issue since there is no context for the link.
Testing Instructions
Testing Instructions for screen reader users
After creating a new post as described above, go to the front view of the post.
Remember that the post has no title, and depending on the theme template, the single post may display
a featured image above the post content. The image that you want to test is the linked image and it should be the only item in the post content.
Confirm that both the link and the image are announced, followed by "Untitled post number".
Voiceover announces "Visited, link, image, Untitled post 720".
Screenshots or screencast