GRI-2234: 0.2.1 - button labels meet WCAG AA contrast in both themes #3
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoirix-frontend-template!3
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GRI-2234-dark-primary-contrast"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2. Board: GRI-2234. Reported by Astraea for
grimoirix-www#4(M4 accessibility checks).What was wrong
The issue reports one pair. Measuring every label-on-fill pair the components draw found four failures against WCAG 2.1 AA (4.5:1, normal text):
.gx-btn--primary, rest#7B2FF7, arcane purple).gx-btn--primary:hover#6A28D9).gx-btn--danger:hover#B81C32).gx-btn--dangerlabel on page#B81C32)axe only reported the first one because it measures the resting state. Hover is covered by the same WCAG criterion.
Why new tokens and not a new
--primaryIn dark mode,
--primary-hoveris also the link colour (a { color: var(--primary-hover) }, 7.30:1 on the page).--primaryis also used for card accents, nav and toggle borders, and the sigil. A fill behind light text has to be dark, and a link or accent on a dark page has to be light. One token cannot be both. Darkening--primary/--primary-hoverwould have fixed the button and broken links and accents in every product.So the buttons now draw on role tokens:
--primary-fill(+-hover,-pressed),--danger-filland--danger-text. The accent tokens keep their values. The light theme looks exactly as before: its fills equal its old values. The only visible change is in the dark theme: primary button, its hover, and the danger button's hover.Guard
npm run checknow ends withscripts/check-contrast.mjs. It reads the generatedgrimoirix.cssand measures 12 pairs per theme: every button state, body and muted text, and links. Exit codes: 0 = all pass, 1 = a pair fails, 2 = a token is missing, which means nothing was measured, so it is not a pass. I checked that it catches the defect: restoring#8B45FFmakes it exit 1 withFAIL dark 4.30:1.Version
0.2.1, not 0.3.0. The new tokens exist only to fix a bug.
grimoirix-wwwpins^0.2.0, and for a 0.x version npm reads that range as<0.3.0. A 0.2.1 reaches it throughnpm update @grimoirix/designwith no range edit.One behaviour change for consumers: a project that set
$dark-overrides: (primary: …)to recolour its buttons now has to overrideprimary-fillinstead. No current consumer does this (grimoirix-wwwhas no overrides).After merge
Tag
v0.2.1and publish (needs awrite:packagetoken, see README). Thengrimoirix-wwwtakes it withnpm update @grimoirix/design, and Astraea's axe and Lighthouse run on/projects/can be repeated.Checks
npm run checkpasses: build is reproducible, prettier and tsc are clean, contrast exits 0. This repository has no CI, so this local run is the only gate.