-
Notifications
You must be signed in to change notification settings - Fork 226
fix(avatar): Avatar component now always includes alt attribute #5512
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 6f855e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 84 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Branch previewReview the following VRT differencesWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
If the changes are expected, update the |
Tachometer resultsChromeavatar permalinktest-basic
Firefoxavatar permalinktest-basic
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but I think we're missing an opportunity to inform customers of an important accessibility improvement they can make by reporting this missing content in dev mode.
packages/avatar/src/Avatar.ts
Outdated
alt=${ifDefined(this.label || undefined)} | ||
src=${this.src} | ||
/> | ||
<img class="image" alt=${this.label || ''} src=${this.src} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to surface a dev-mode warning that alt text is missing and that the image will be skipped by screen readers if not provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having an empty alt
attribute is acceptable for decorative avatars, so I'm afraid flagging it may just add console noise for valid use cases. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(e.g., the profile picture avatar in Adobe Home is decorative)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss, because the A11Y team also has concerns: #5513 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revoking my approval for further discussion, after this comment:
#5513 (comment)
Description
This PR enhances the
<sp-avatar>
component to improve accessibility, particularly for decorative avatars. The update introduces a new property, isdecorative, and updates the rendering and accessibility logic for avatars used purely for decoration.Key Changes
<sp-avatar>
.Motivation
Some avatars are decorative and should not be announced by screen readers. This change allows consumers of
<sp-avatar>
to explicitly mark avatars as decorative, ensuring correct ARIA attributes are applied and accessibility warnings are surfaced during development.Related Links
Checklist
isdecorative
property to<sp-avatar>
isdecorative
isdecorative
Let me know if you want this tailored further, or if you have a specific template you’d like me to use!
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Descriptive Test Statement
Descriptive Test Statement
Device review