Page MenuHomePhabricator

Replace Less `unit()` calculation to output relative em/rem sizes
Closed, ResolvedPublic1 Estimated Story Points

Description

Background

The Less compiler does not allow use of CSS custom properties in calculations.

With the introduction of T387778: [breaking change] Font modes: Introduce font modes to Codex, certain Less token values in Codex have changed to reference CSS custom properties. This will break the Less compiler unless we update the code using the affected tokens.

Example:

@max-width-search: unit( ( 500px / @font-size-browser / @font-size-small ), em ); // 35.71428571em @ 16 & 0.875em T270202

Note that @font-size-browser = 16. The Codex token @font-size-small used to be 0.875rem and is being updated to var( --font-size-small, 0.875rem ).

Goal

Determine how to updated each affected line of code with no or acceptable visual changes. The affect lines are:

Acceptance criteria

  • Evaluate all cases of unit() calls and update the code to work with the updated Codex tokens
    • Vector
    • MobileFrontend
  • Ensure there are no significant visual changes or regressions

Event Timeline

Change #1129918 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/skins/Vector@master] styles: Remove obsolete var that relies on problematic Less `unit()``

https://gerrit.wikimedia.org/r/1129918

Change #1131031 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[mediawiki/skins/Vector@master] styles: Update `unit()` calls

https://gerrit.wikimedia.org/r/1131031

Test wiki created on Patch demo by ATomasevich (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/cedcfe0d08/w/

Change #1131789 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[mediawiki/extensions/MobileFrontend@master] styles: Remove unneeded `unit()` function call

https://gerrit.wikimedia.org/r/1131789

Change #1131789 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] styles: Remove unneeded `unit()` function call

https://gerrit.wikimedia.org/r/1131789

CCiufo-WMF set the point value for this task to 1.Mar 31 2025, 5:29 PM

Change #1129918 merged by jenkins-bot:

[mediawiki/skins/Vector@master] styles: Remove obsolete vars relying on problematic Less calculations

https://gerrit.wikimedia.org/r/1129918

Change #1131031 merged by jenkins-bot:

[mediawiki/skins/Vector@master] styles: Update `unit()` calls

https://gerrit.wikimedia.org/r/1131031

Closing this since all patches are merged!

Test wiki on Patch demo by ATomasevich (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmcloud.org/wikis/cedcfe0d08/w/