Measure the contrast of every stylesheet this project ships, and darken the one that reads under it

Closes [#3624518].

The task inbox writes the assignee cell of an unclaimed task in #767f88. On the row that is 4.07:1, and on the hovered row (#f8fafc, set a few rules above it in the same file) 3.89:1. WCAG 2.1 AA success criterion 1.4.3 asks 4.5:1.

It is darkened to #646d76, which keeps its blue-gray cast and reads 5.26:1 and 5.03:1 on those two grounds.

The half that matters more

The project already computed this rather than judging it by eye, and still shipped the failure, because the guard read one stylesheet. PresentationAssetsTest parsed cards.css, resolved each cascade and failed under 4.5:1, with a completeness check so a rule added to that file could not ship unmeasured. Four other stylesheets were outside it.

So the rule moves to where this project's stylesheets are counted: StylesheetContrastTest, a Unit test over getShippedStylesheets(), which is new on ShippedFilesTrait beside the collectors the other project-wide guards already use. Three assertions:

  • every pair named in the table clears 4.5:1;
  • every rule in every shipped stylesheet that declares a color or a background is either named by a case or listed as painting no text of its own, with a reason - so a new tone, or a whole new stylesheet, cannot arrive unmeasured;
  • every stylesheet the tables name is still a stylesheet, so a rename cannot make either rule pass over it in silence.

PresentationAssetsTest keeps what is genuinely about the card component - the library resolves, the row is an overridable theme hook, the engine ships no presentation - and no longer carries a second implementation of the contrast rule.

Proven both ways

Against the shipped color the new guard fails with the ratio:

An unassigned task reads #767f88 on #ffffff, which is 4.07:1.
WCAG 2.1 AA asks 4.5:1 of text. (modules/orchestra_inbox/css/inbox.css)

With #646d76 it passes: 3 tests, 247 assertions. Every other shipped pair was already clear and is now measured: the card and status palettes 4.69:1 to 17.40:1, the instance-detail timestamp 5.41:1.

User interface changes

The assignee cell of an unclaimed task in the inbox reads in a darker gray.

Edited by Frank Mably

Merge request reports

Loading
Loading