Page MenuHomePhabricator

Color is autocorrected to #333 even when background-color is defined using Codex variables
Closed, ResolvedPublicBUG REPORT

Description

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

What happens?:
The text color is the default text color for light mode.
What should have happened instead?:
Text color should have been the defalt text color for night mode.
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
The MediaWiki software autocorrects text color to #333 if background-color is defined but color is not (T358797). This is done to ensure proper color contrast for night mode. However, when background-color is defined using a CSS variable (e.g. Codex tokens), this is not necessary, and in fact causes color contrast issues of its own. https://www.mediawiki.org/wiki/Recommendations_for_night_mode_compatibility_on_Wikimedia_wikis suggests defining only background-color is acceptable as long as CSS variables are used.

Event Timeline

Jdlrobson subscribed.

The MediaWiki software autocorrects text color to #333 if background-color is defined but color is not (T358797). This is done to ensure proper color contrast for night mode. However, when background-color is defined using a CSS variable (e.g. Codex tokens), this is not necessary, and in fact causes color contrast issues of its own. https://www.mediawiki.org/wiki/Recommendations_for_night_mode_compatibility_on_Wikimedia_wikis suggests defining only background-color is acceptable as long as CSS variables are used.

I forget why we added the qualifier for this rule in the recommendations, and it's not clear from the documentation so I've removed it as it seems wrong. Perhaps what we intended to say here, is in certain cases you can get away with just defining the background, but as a general rule of thumb those are in the minority. For example, https://en.m.wikipedia.org/wiki/Special:LintErrors/night-mode-unaware-background-color intentionally flags all violations, even if you use design tokens.

Jdlrobson claimed this task.

This is working as expected and the documentation has been updated.