Avatar accessibility
WCAG 2.1 AA requirements
Image alt text
AvatarImageaccepts analtprop. Always provide a meaningful name (e.g., the person's full name), not a description of the image.- If the avatar is purely decorative (e.g., next to a visible name), set
alt=""so screen readers skip it.
Fallback
AvatarFallbackrenders witharia-hiddenbecause the image'salttext (or the adjacent visible name) is the accessible label. The initials are a visual cue only.- If no
AvatarImageis present and the avatar is the only representation of the user, ensure anaria-labelis set on theAvatarwrapper.
Contrast
- Fallback text (initials) against the
bg-mutedbackground must meet 4.5:1 contrast in both light and dark themes. - When using custom
classNameoverrides on fallback colours, verify contrast manually.
Focus
- Avatars are not interactive by default. If you make an avatar clickable (e.g., linking to a profile), wrap it in an
<a>or<button>with a descriptivearia-label.
Audit checklist
-
alttext onAvatarImagematches the entity name - Decorative avatars use
alt="" - Fallback text meets 4.5:1 contrast
- Clickable avatars have an accessible label and focus ring