Skip to content

Add link context in avatar alt#153

Open
obenland wants to merge 2 commits into
masterfrom
add/meaningful-alt
Open

Add link context in avatar alt#153
obenland wants to merge 2 commits into
masterfrom
add/meaningful-alt

Conversation

@obenland

Copy link
Copy Markdown
Member

For a linked image the alt attribute is actually the link textual content.

See https://meta.trac.wordpress.org/ticket/3371#comment:19

@obenland obenland requested a review from pento February 20, 2018 19:54

@pento pento left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copilot AI review requested due to automatic review settings July 9, 2026 20:51
@obenland obenland force-pushed the add/meaningful-alt branch from 59b65f5 to 9f23e57 Compare July 9, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves accessibility for author avatar links in the post and post-edit templates by giving the linked avatar image a meaningful alt text (using the existing data.author.urlTitle string as link context), aligning with the referenced Trac accessibility guidance.

Changes:

  • Set the author avatar <img> alt attribute to {{ data.author.urlTitle }} in the main post template.
  • Set the author avatar <img> alt attribute to {{ data.author.urlTitle }} in the post-edit template.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
inc/tpl/post.php Adds link-context alt text to the linked author avatar image.
inc/tpl/post-edit.php Adds link-context alt text to the linked author avatar image in edit UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread inc/tpl/post.php
<# if ( ! data.isPage && o2.options.showAvatars && data.author.avatar ) { #>
<a href="{{ data.author.url }}" title="{{ data.author.urlTitle }}" class="author-avatar {{ data.author.modelClass }}">
<img src="{{ data.author.avatar }}" alt="" width="{{ data.author.avatarSize }}" height="{{ data.author.avatarSize }}" class="avatar {{ data.author.modelClass }}" />
<img src="{{ data.author.avatar }}" alt="{{ data.author.urlTitle }}" width="{{ data.author.avatarSize }}" height="{{ data.author.avatarSize }}" class="avatar {{ data.author.modelClass }}" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants