Jump to content
Wikimedia Meta-Wiki

Community Wishlist/Wishes/Allow use of modern CSS in templates by updating the TemplateStyles CSS sanitizer/en

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by FuzzyBot (talk | contribs) at 20:05, 27 February 2025 (Updating to match new version of source page). It may differ significantly from the current version .
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Other languages:
Allow use of modern CSS in templates by updating the TemplateStyles CSS sanitizer Open

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

Unknown

All projects

Affected users

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

Phabricator tasks

T271958, T320322

Other details

AltStyle によって変換されたページ (->オリジナル) /