Page MenuHomePhabricator

Error on font sizes
Closed, ResolvedPublic



Expected behavior: The style guide asks for font sizes using "scale-independent pixels (sp)" with paragraph text in 16 sp

Observed behavior: Seeing an error when inspecting the styles:

Screen Shot 2020-08-12 at 4.17.56 PM.png (154×602 px, 28 KB)

I'm not sure how to test whether this is actually resulting in the wrong font size, but the error seems worth investigating. Note that this also seems to be happening on headings.

Event Timeline

apaskulin triaged this task as Medium priority.Aug 12 2020, 11:22 PM
apaskulin renamed this task from Error on paragraph text to Error on font sizes.Aug 19 2020, 8:16 PM
apaskulin updated the task description. (Show Details)

CSS does not support sp as a unit, as indicated by the warning. In the example you point to, it defaults to 16px, which is specified elsewhere in the style files. If scalable units are required, rem or em units are recommended. There is a good discussion of their usage at Usages of 'sp' in the less files should be converted to a supported unit.

Thanks for the link, Cindy! This calculator was particularly helpful. If I understand correctly, best practices indicate that all size units on the site should use rem instead of px. To fulfill this task, I replaced only those font sizes with sp units or those used in page content. Should we open a separate task to track converting all px units on the site to rem? A quick search of the styles directory shows about 80 occurrences.

Change 626720 had a related patch set uploaded (by Alex Paskulin; owner: Alex Paskulin):
[mediawiki/skins/WikimediaApiPortal@master] styles: Change content font sizes to rem

That's a great calculator. Yes, I agree that a separaqte task to convert all px units would be good. That may also resolve the issue with T260700.

Change 626720 merged by jenkins-bot:
[mediawiki/skins/WikimediaApiPortal@master] styles: Change content font sizes to rem