Repository navigation
fix: WCAG 2.1 AA contrast failures in core color tokens (#3654) - #4022
gonzoblasco wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @gonzoblasco! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
ernestt
left a comment
There was a problem hiding this comment.
Our understanding is that disabled text and buttons are exempt from the contrast requirements
gonzoblasco
left a comment
There was a problem hiding this comment.
Thanks for the review, @ernestt.
You're right that WCAG 2.1 SC 1.4.3 explicitly exempts "text that is part of an inactive user interface component" from contrast requirements. I should have separated the concerns more clearly in the PR.
Let me break down the three tokens:
--color-text-disabled - Fair point. This is exempt under SC 1.4.3. Happy to revert this to the original values if that's the team's preference.
--color-icon-disabled - Also debatable under SC 1.4.11. If the icon is purely decorative or part of a disabled/inactive control, the exemption applies. I'd lean toward reverting this one too.
--color-border-emphasized - This one is different. It's not a disabled token - it's an active border used for emphasized states (focused inputs, active cards, etc.). At 1.37:1 on light backgrounds, it's barely perceptible and fails SC 1.4.11 (Non-text Contrast, 3:1 minimum) for active UI components. This is a genuine bug, not a design preference.
So my proposal: revert --color-text-disabled and --color-icon-disabled to their original values, and keep only the --color-border-emphasized fix. Or if you'd prefer, I can split this into a smaller PR that only addresses --color-border-emphasized.
What do you think?
|
Updated per review feedback: reverted As discussed, disabled tokens are exempt under WCAG 2.1 SC 1.4.3/1.4.11. The border-emphasized token is an active UI component that genuinely fails SC 1.4.11 (Non-text Contrast) at 1.37:1 on light backgrounds. Ready for re-review. |
74a225c to
3de1f86
Compare
Fixes three tokens that failed WCAG 2.1 AA contrast ratios against standard surface/body/popover backgrounds: - --color-text-disabled: light #A4B0BC → #697078 (4.54:1 on body), dark #6F747C → #8C9096 (4.53:1 on popover) - --color-icon-disabled: light #A4B0BC → #858E98 (3.01:1 on body) - --color-border-emphasized: light #CCD3DB → #898D93 (3.02:1 on body), dark #494D53 → #6E7276 (3.00:1 on popover) All values computed using the WCAG 2.1 relative luminance formula, maintaining the original hue while adjusting luminance. Tests: 521/521 pass (13 test files)
As discussed with @ernestt: disabled text and icons are exempt from WCAG 2.1 SC 1.4.3/1.4.11 contrast requirements. Keeping only the --color-border-emphasized fix, which is an active UI token that genuinely fails SC 1.4.11 (Non-text Contrast) at 1.37:1 on body.
3de1f86 to
65a7799
Compare
|
Hi @ernestt and team - following up on the earlier review. I've updated the PR body to reflect the current state. Per the feedback on disabled tokens (exempt under SC 1.4.3), I reverted both A couple of things that may help with the review:
Would appreciate a re-review when you get a chance. Happy to split the audit scripts into a separate PR if the team prefers the token change alone. |
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual RegressionStatus: Skipped — Broad stable scope is deferred to the daily release gate. It covers 974 trusted baseline shots instead of recapturing them for this PR. View the report Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for narrowing this after @ernestt's review; reverting the disabled-token changes addressed that concern. The emphasized-border update is separable and aligns with the 3:1 non-text contrast contract.
Please remove the two unnecessary executable additions, scripts/audit-contrast.mjs and scripts/find-compliant-colors.mjs, and leave the base-theme token update as the focused change. If you'd rather talk it through with someone, we're in Discord.
[Reviewed by Robohands]
Keep the PR focused on the base-theme token change per review feedback.
|
@cixzhang, done - removed |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks, both scripts are gone, clearing my previous block. The token change looks good. Before merge, please regenerate tokens.doc.mjs and remove stale script references from the PR body.
[Reviewed by Robohands]
|
Both items are done:
The PR is now scoped to just the base-theme token change. Checks are re-running on the latest commit. |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks, the generated token docs now match the source and the stale script references are gone, clearing both notes from my prior approval.
[Reviewed by Robohands]
|
Thank you for the audit and the careful revisions. Color-token contrast work needs coordinated accessibility and design ownership rather than parallel implementation PRs. #3654 is assigned to @rubyycheung and the program is tracked in #4475, so we are closing this attempt. |
What
Fixes a WCAG 2.1 AA non-text contrast failure reported in #3654:
--color-border-emphasizedwas below the 3:1 minimum against standard surface/body backgrounds.Change
--color-border-emphasizedis an active border (focused inputs, active cards, emphasized states), not a disabled token. At 1.37:1 on light backgrounds it was barely perceptible - a genuine bug, failing SC 1.4.11 (Non-text Contrast, 3:1 minimum) for active UI components.#CCD3DB→#898D93(3.02:1 on body, was 1.37:1)#494D53→#6E7276(3.00:1 on popover, was 1.71:1)Scope note (updated after review)
The original PR also proposed changes to
--color-text-disabledand--color-icon-disabled. Per review feedback (@ernestt), those are exempt under WCAG SC 1.4.3 (text in inactive UI components), so both were reverted. This PR now contains only the--color-border-emphasizedfix.Methodology
Values computed with the WCAG 2.1 relative luminance formula, maintaining hue while adjusting luminance - the same contrast-measurement approach the component audits (#5332) use.
Validation
pnpm lint: cleanpnpm check:sync: cleanpnpm check:package-boundaries: cleanFixes #3654