Page MenuHomePhabricator

Prevent css-icon mixin from breaking when nonstandard sizes are used
Closed, ResolvedPublic3 Estimated Story Points

Description

I was confused about this at first, because I thought you could just pass a non-standard icon size into the icon mixin. But when I try that, I get:

load.php?lang=en&mod…22&version=1bu2z:31 Less_Exception_Compiler: variable @calculated-min-size-icon is undefined in file /var/www/html/w/resources/lib/codex/mixins/css-icon.less in css-icon.less on line 44, column 26
42| 		// This ensures that the icon will never appear smaller than @calculated-min-size-icon.
43| 		// Escape the max() call to prevent older Less versions from trying to do the max() calculation at compile time.
44| 		background-size: calc( ~'max( @{param-size-icon}, @{calculated-min-size-icon} )' );

Now that we use rems, I wonder if we can remove the size-icon -> min-size-icon mapping, and instead just derive the min-size from the size by multiplying the size token by 16 and changing the unit from rem to px. Or alternatively, we could keep the mapping for known values, and do the math for custom values, or use the smallest min-size for custom values, or something like that.

The css-icon mixin should not throw an error when a non-standard size is passed in.

Event Timeline

AnneT triaged this task as Low priority.Jun 10 2024, 5:25 PM
AnneT created this task.
AnneT set the point value for this task to 3.
Catrope renamed this task from [placeholder] Prevent css-icon mixin from breaking when nonstandard sizes are used to Prevent css-icon mixin from breaking when nonstandard sizes are used.Jun 10 2024, 5:27 PM
Catrope updated the task description. (Show Details)

Change #1048126 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] css-icon: Don't crash when `@param-size-icon` is a non-standard value

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

Change #1048126 merged by jenkins-bot:

[design/codex@main] css-icon: Don't crash when `@param-size-icon` is a non-standard value

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

Change #1049640 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from 1.7.0 to 1.8.0

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

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/f74be9bc8e/w

Change #1049640 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from 1.7.0 to 1.8.0

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