[1.x] fix(a11y): missing default alt text for avatar#4242
Merged
Conversation
afa6052 to
ffdcaf7
Compare
9 tasks
DavideIadeluca
suggested changes
Oct 3, 2025
Contributor
DavideIadeluca
left a comment
There was a problem hiding this comment.
Tested locally — working as expected, though I have some improvements for the case where no avatarUrl exists
The alt property should be omitted in case of no user avatar (alt on span is invalid)
DavideIadeluca
approved these changes
Oct 3, 2025
Contributor
DavideIadeluca
left a comment
There was a problem hiding this comment.
tested locally, looks good to me now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR improves accessibility of the avatar helper by ensuring that
avatars include meaningful alt text by default.
• If a user is present and no alt attribute is provided, it falls back to the user’s display name.
• If explicitly set to null/false, the alt attribute is omitted (treated as decorative).
• For cases where no user is passed, the alt defaults to an empty string.
This change aligns avatars with WCAG guidelines by providing screen readers with descriptive text, while still allowing developers to override or suppress alt when needed.
A follow-up PR for
2.xwill also be madeFixes #0000
Changes proposed in this pull request:
Reviewers should focus on:
Screenshot
Necessity
Confirmed
composer test).Required changes: