Jump to content

Allow use of modern CSS in templates by updating the TemplateStyles CSS sanitizer (Community Wishlist/W350)

Done
From Meta, a Wikimedia project coordination wiki

View all wishes.

Description

Many modern formatting and styling (CSS) techniques are not allowed by TemplateStyles, including

  • modern units such as lh, which would allow our wiki templates to adapt to different line height values used by different skins
  • certain invocations of var(), a crucial function for adapting templates to dark mode
  • width: fit-content, which removes the need to force templates to have a pre-set fixed width or span the entire width of the page
  • media queries that appear in MediaWiki CSS, such as @supports ( mask-image: none; ), which are needed if we want to override certain core CSS styles (e.g. CategoryTree)

This is a great source of frustration for template creators and maintainers, and leads to either (a) the creation of hacky workarounds which will no doubt break on some devices and/or when skins change, or (b) resorting to placing styles in MediaWiki:Common.css, increasing page sizes and adding to maintenance burden.

The CSS sanitiser needs to be regularly kept up to date.

Also, to avoid wasting time, we need to see sanitiser warnings on preview, not only on save.

Assigned focus area

Unassigned

Type of wish
I'm not sure or I don't know
Tags
Affected users

Template editors and maintainers, (indirectly) interface admins - and ultimately the readers who benefit from modern, accessible, adaptive styling

Phabricator tasks
Other details
Voting

This wish currently has 1 supporter. Supporting this wish is currently disabled.

Supporters of this wish
Support This, that and the other (talk) 11:30, 9 January 2025