[1.x] fix(a11y): missing default alt text for avatar #4242
Merged
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: