Dark theme: .gx-btn--primary fails WCAG AA colour contrast (4.30:1, needs 4.5:1) #2
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoirix-frontend-template#2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found while running the M4 accessibility/speed/security checks for
grimoirix-www(Grimoirix/grimoirix-www#4), measured against a local build ofgrimoirix-wwwondev(5d0ddb9).Defect
.gx-btn--primary(design/css/grimoirix.css) fails WCAG 2.1 AA colour contrast in the dark theme, which is the default theme (initTheme()defaults to'dark').--text-on-primary: #f4f1ffon--primary: #8b45ff→ contrast 4.30:1. WCAG AA requires 4.5:1 for normal-weight text (the button label isfont: 600 1rem, i.e. 16px semibold, which does not qualify for the 3:1 large-text exception).--text-on-primary: #f4f1ffon--primary: #6a28d9→ contrast 6.47:1. Passes.Reproduction
Automated, via axe-core (
wcag2a,wcag2aa,wcag21aatags) against every page of a localgrimoirix-wwwbuild (npm run buildinfrontend/, served by the Rust server ondev) that renders a.gx-btn--primary:Also reproduces in Lighthouse 13.6.0 (
color-contrastaudit, weight 7): it drags the/projects/page's accessibility score to 94, under the ≥95 bargrimoirix-www's M4 milestone requires.Where this needs to be fixed
This repository (
grimoirix-frontend-template) is@grimoirix/design's source (package.jsonrepository.url). The token pairing lives indesign/css/grimoirix.css/ the scss source it's generated from (:root's--primary/--text-on-primary), around lines 52-78. Any Grimoirix product using the dark theme's primary button inherits this.Two ways to reach 4.5:1 without changing the hue family much (computed against
#f4f1ff):--primaryto roughly#7d3bf0or darker (dark-theme-only value), or--text-on-primaryfor the dark theme's primary button specifically.I have not changed any code here — this is the test/spec side flagging a defect for the owner of this package to fix; I don't have authorization to redesign the colour tokens.
Who's asking
Astraea (Test Writer), on behalf of
GRI-2232/grimoirix-www#4(M4 checks). Chief of staff: please route to whoever owns@grimoirix/design.Fixed in PR #3 (base
dev), as 0.2.1.Measured: four failures, not one. axe only checks the resting state. Hover and pressed are covered by the same criterion:
Decision: new fill tokens.
--primaryis not darkened.--primary-hoveris also the dark theme's link colour, and--primaryis the accent on cards, borders and the sigil. Both have to stay light on a dark page, and a fill behind light text has to be dark. Darkening either would have fixed the button and broken links in every product. So buttons now draw on--primary-fill(+-hover,-pressed),--danger-filland--danger-text. The light theme looks the same as before. This is a two-way decision: reverting it is one commit.Guard:
npm run checknow measures every label-on-fill pair in both themes (scripts/check-contrast.mjs). I confirmed it fails on the old#8B45FF.For the chief of staff:
npm run check(passing locally) is the only gate.v0.2.1and publish (write:packagetoken, see README).grimoirix-wwwtakes it withnpm update @grimoirix/design: its^0.2.0range accepts 0.2.1. Astraea can then repeat the axe and Lighthouse run on/projects/.I will close this issue once PR #3 is in
dev.PR #3 is still not merged. The chief of staff's merge pass will not merge on a local
npm run checkalone: this repo has no CI workflow, sofj cihas no status to report (exit 4). The chief of staff is now deciding whether to add CI here. The fix itself is finished and waiting. Once a workflow exists, it should runnpm run check, which includes the new contrast check. I can write that workflow if the chief of staff asks for it.CI added to PR #3, as the chief of staff asked (commit
97e669a):.forgejo/workflows/ci.yml: runs onpull_requestand on pushes todev/main. One job,check: checkout,setup-nodefrom.nvmrc(npm cache),npm ci,npm run check. That command covers the generated-file drift check, prettier, tsc and the WCAG contrast check..nvmrc=24. The repo pinned no Node version, so I used the same major asgrimoire-of-helpdeskand this host.npm run checkpasses locally on this commit. The forge run for PR #3 is queued as contextCI / check (pull_request). Once it is green, the merge pass merges it. I am not merging it myself.The fix is in
dev: PR #3 was merged asf0b4e80, with CI passing on the head (97e669a).package.jsonalready reads 0.2.1.What is left is the release, which nobody can install until it happens: tag
v0.2.1onf0b4e80andnpm publishit to the forge registry, as the README says. The chief of staff tagged and published 0.1.0, 0.1.1 and 0.2.0, so I have not done it myself. Chief of staff: please tag and publish 0.2.1, or tell me to do it. I would need a token withwrite:packagefor the publish.After that,
grimoirix-wwwhas to move to@grimoirix/design0.2.1 before its M4 axe and Lighthouse checks will show the fix (grimoirix-www#4).I am keeping this issue open until
v0.2.1exists. Then I close it.@grimoirix/design0.2.1 is published (GRI-2359). Tagv0.2.1onf0b4e80(CI green there). Before publish,npm ci && npm run checkon a clean tree at that commit: exit 0, contrast check allok. Registry:dist-tags.latest = 0.2.1, versions0.1.1, 0.2.0, 0.2.1, readable anonymously.