fix(AvatarStatusDot): resolve WCAG 2.1 SC 1.4.1 use-of-color failure#4218
Open
gonzoblasco wants to merge 1 commit into
Open
fix(AvatarStatusDot): resolve WCAG 2.1 SC 1.4.1 use-of-color failure#4218gonzoblasco wants to merge 1 commit into
gonzoblasco wants to merge 1 commit into
Conversation
The AvatarStatusDot component relied on colour alone to convey status (success=green, neutral=gray, error=red), which fails WCAG 2.1 Success Criterion 1.4.1 (Use of Color). Changes: - Add default icons per variant (checkmark, dash, cross) so shape reinforces meaning alongside colour at medium+ avatar sizes - Add default accessible labels per variant so screen readers always announce status meaning, including at the smallest avatar tier where icons cannot be rendered - Make fall back to a sensible default per variant - Allow to explicitly suppress the default icon - Update JSDoc with WCAG 1.4.1 rationale Backward compatible: explicit and props still take precedence. Consumers who already pass these props see no change. Closes facebook#4143
gonzoblasco
requested review from
cixzhang,
ejhammond and
imdreamrunner
as code owners
July 22, 2026 23:00
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 22, 2026 23:00
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.
Summary
Resolves #4143
The
AvatarStatusDotcomponent relied on colour alone to convey status meaning (green=success, gray=neutral, red=error), which fails WCAG 2.1 Success Criterion 1.4.1 (Use of Color).Users with colour vision deficiencies (deuteranopia, protanopia, tritanopia, achromatopsia) cannot distinguish between the three status states, and screen readers have no way to announce the status when no
labelis provided.Solution
Two-pronged approach to ensure status is never conveyed by colour alone:
1. Default icons per variant (shape differentiation)
When no
iconprop is provided, a default SVG icon is rendered inside the dot based on the variant:successneutralerrorThese icons are rendered at medium+ avatar sizes (≥ 40px) where there is enough room. At the smallest tier (≤ 36px, dotSize=10px), icons are not legible, so shape differentiation falls back to the accessible label.
2. Default accessible labels per variant (screen reader support)
When no
labelprop is provided, a default label is derived from the variant ("Success","Neutral","Error"). This ensures:role="img"attribute is always set when there's a labelBackward compatibility
labelprop still takes precedence over the defaulticonprop still takes precedence over the defaulticon={null}explicitly suppresses the default iconWhat this fixes
Before (WCAG 1.4.1 fail):
After (WCAG 1.4.1 pass):
Testing
Added 8 test cases covering:
icon={null}suppressionChecklist