Page MenuHomePhabricator

Module:Citation introduces accessibility issue (cs1-visible-error)
Closed, ResolvedPublicBUG REPORT

Description

This issue impacts > 300 projects https://global-search.toolforge.org/?q=cs1-visible-error+%5C%7B&regex=1&namespaces=&title=https://global-search.toolforge.org/?q=cs1-visible-error+%5C%7B&regex=1&namespaces=&title=
It is only shown on error so hopefully not encountered by too many people.

Steps to replicate the issue (include links if applicable):

What happens?:
There is an accessibility color contrast violation in the references meaning it is unreadable to some users:

Screenshot 2024-03-11 at 6.06.15 PM.png (105×569 px, 28 KB)

What should have happened instead?:

.cs1-visible-error {
  color: var( --color-error );
}

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
This style has been copied to multiple projects so might be best fixed by a bot once we've worked out what to do here.

Event Timeline

While I appreciate the suggested change, that depends on T320322 to fix this in the source module though I'd be happy to make that change once it is possible.

These are the exception rather than the norm I would say. And 4.0 contrast for an error is pretty tolerable (#d33 vs #101418 if my inspector is right for the latter?). It might be possible to find a red that works between both white and #101418 but I'm dumb to color things and so all I have is guess and check which is exhausting.

(Why are there no websites that do triple contrast checking, between one color and two backgrounds. :()

Just noting that the following CSS can be used now in lieu of CSS variables:

html.skin-theme-clientpref-night .cs1-visible-error {
  color: #f8a397
}
@media (prefers-color-scheme: dark) {
   html.skin-theme-clientpref-os .cs1-visible-error {
    color: #f8a397
   }
}

Another alternative is for .cs1-visible-error to implement itself via standard error class while resetting some of its properties.

Just noting that the following CSS can be used now in lieu of CSS variables:

That won’t fix the problem completely since the references in Minerva also get rendered inside a black box in the default skin theme. Similar to T360276

Another alternative is for .cs1-visible-error to implement itself via standard error class while resetting some of its properties.

This is how it was until T280766. That was enough writing on the wall to ditch the name.

This is how it was until T280766. That was enough writing on the wall to ditch the name.

Oof. Maybe if Jdlrobson pinky-promises to not touch that class again, you can use error with cs1-specific class?

Or I can just wait for variables/add the extra rules in the sheet. :)

The error class is not standard and like all CSS classes not covered by our stable policy unless specifically documented in the code. I don't recommend using it.

The only really viable solutions here are:

  1. Use var ( --color-error, /* fallback */ ) in MediaWiki:Minerva.css right now, or in template style when T360562 is complete
  2. Use an override as outlined in T359894#9654836
Izno claimed this task.

This has been fixed in the live modules for a bit now with prefers-color-scheme, and I've switched it over in the sandbox to the token for whenever that gets synced to the live modules. Other wikis can copy the implementation, or it can be spread to the masses, etc. etc.