Background
The CSS sanitizer doesn't allow CSS variables, which means that editors cannot follow our guidance on https://www.mediawiki.org/wiki/Recommendations_for_night_mode_compatibility_on_Wikimedia_wikis#Use_CSS_variables_or_CSS_design_tokens_with_fallback_for_background_and_text_where_possible
There is a broader request for CSS variables in T320322 but this is the minimum level of support we need to support night mode.
User story
As a template editor I want to use Codex design tokens for my CSS rules, so that they adapt to the night theme experience.
Requirements
- I should be able to edit https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Template:Tracked/styles.css and save the following text without receiving an error "Invalid or unsupported value for property background-color at line 7 character 21.
"
/* {{pp|small=y}} */
.tracked {
float: right;
clear: right;
margin: 0 0 1em 1em;
width: 12em;
border: 1px solid var( --border-color-interactive );
border-radius: 2px;
background-color: var( --background-color-neutral );
font-size: 85%;
text-align: center;
padding: 0.5em;
}- (for now) I should not be able to reassign or define CSS variables. e.g. the following should trigger an error:
:root {
--color-base: red;
}
html.skin-theme-clientpref-os #shortcut
--color-base: red;
}