Page MenuHomePhabricator

Typography: Audit font sizes across Vector 2022 and Minerva
Closed, ResolvedPublic3 Estimated Story Points

Assigned To
Authored By
ovasileva
Aug 18 2023, 8:24 PM
Referenced Files
F37690891: Screenshot 2023-09-11 at 10.57.46 AM.png
Sep 11 2023, 3:04 PM
F37690888: Screenshot 2023-09-11 at 10.57.31 AM.png
Sep 11 2023, 3:04 PM
F37657181: Font size entry points in Vector.jpg
Sep 5 2023, 2:01 PM
F35341261: Screen Shot 2022-07-26 at 11.28.57 AM.png
Aug 18 2023, 8:24 PM
File Not Attached
F35341259: Screen Shot 2022-07-26 at 11.30.14 AM.png
Aug 18 2023, 8:24 PM
File Not Attached
F35341235: Screen Shot 2022-07-26 at 11.29.09 AM.png
Aug 18 2023, 8:24 PM
File Not Attached
F35341208: Screen Shot 2022-07-26 at 11.29.14 AM.png
Aug 18 2023, 8:24 PM
File Not Attached
F35341041: Screen Shot 2022-07-26 at 11.24.53 AM.png
Aug 18 2023, 8:24 PM
File Not Attached

Description

Background

We would like to audit all existing font sizes across the Vector 2022 and Minerva skins. This audit will help us in determining how to apply future typographical changes.

Pre-work

from T313828: [EPIC] Typography: improve typography and allow for variable typography settings

Pre-reading

How this will impact VisualEditor

T315596#8167345

Catalogue of font sizes in Vector 2022

Computed font sizes based on the browser default 16px font size. Starting from the smallest.

11.76px
Screen Shot 2022-08-18 at 10.17.28 AM.png (1×3 px, 1 MB)
Screen Shot 2022-08-18 at 10.18.03 AM.png (1×3 px, 1 MB)
12px
Screen Shot 2022-07-26 at 11.24.00 AM.png (1×1 px, 503 KB)
Screen Shot 2022-07-26 at 11.30.58 AM.png (1×1 px, 515 KB)
sidebarfooter
12.888px
Screen Shot 2022-07-26 at 2.39.20 PM.png (1×1 px, 847 KB)
Screen Shot 2022-07-26 at 11.25.56 AM.png (1×1 px, 579 KB)
sitesubmw-notify
13px
Screen Shot 2022-07-26 at 11.23.18 AM.png (1×1 px, 502 KB)
Screen Shot 2022-07-26 at 11.23.31 AM.png (1×1 px, 499 KB)
Page toolbarPage toolbar dropdowns
14px
Screen Shot 2022-07-26 at 11.19.31 AM.png (1×1 px, 873 KB)
Screen Shot 2022-07-26 at 11.20.14 AM.png (1×1 px, 865 KB)
Screen Shot 2022-07-26 at 11.23.05 AM.png (1×1 px, 510 KB)
Screen Shot 2022-07-26 at 11.24.34 AM.png (1×1 px, 464 KB)
Screen Shot 2022-07-26 at 11.25.05 AM.png (1×1 px, 455 KB)
Screen Shot 2022-07-26 at 11.29.48 AM.png (1×1 px, 454 KB)
SearchHeader dropdownslanguage buttonTable of contentsSticky header dropdowncontent <H4>
16px
Screen Shot 2022-07-26 at 11.24.53 AM.png (1×1 px, 431 KB)
sticky header language button
Larger font sizes
16.8px21px24px28.88px
Screen Shot 2022-07-26 at 11.29.14 AM.png (1×1 px, 524 KB)
Screen Shot 2022-07-26 at 11.29.09 AM.png (1×1 px, 531 KB)
Screen Shot 2022-07-26 at 11.30.14 AM.png (1×1 px, 548 KB)
Screen Shot 2022-07-26 at 11.28.57 AM.png (1×1 px, 556 KB)
content <H3>content <H2>Sticky header page titlecontent <H1>

Goal

  • Define consistent font sizes for UI elements (preferably just two: small and normal)
  • Define a consistent typographic scale for wiki content
  • Convert font sizes and applicable sizes to rem's instead of em's (T261334).

Proposal

TBD

Details

Other Assignee
KSarabia-WMF

Event Timeline

List to audit, from conversation with @NatHillard:

  • Where are we using raw values where we shouldn’t be?
  • Where are we already using tokens?
  • Where are we already using rems?
  • Viewport sizes and mobile
  • What variables do we need?
  • What values are tied that should be?
  • What values are tied that shouldn’t be / happen to be currently assuming the same value
  • What is the full range of size values we have?
  • Where are we overriding the base font size?
ovasileva set the point value for this task to 3.Aug 24 2023, 5:14 PM

Current Less variable usage in Vector

As part of this investigation, we want to know at what variables we're currently using and why. I tracked code-path of just the @font-size-base variable, and I think there's a lot to untangle here.

  • @font-size base is defined in mediawiki.skin.defaults.less in core and theme-wikimedia-ui.less/ theme-wikimedia-ui-legacy.less in codex.
  • Both of those modules are imported into mediawiki.skin.variables.less in legacy and modern Vector, and subsequently overridden to a value of 1em.
  • That value is overridden again in variables.less which is shared by both modern and legacy Vector to a computed value of something like 0.85em.

Font size entry points in Vector.jpg (1×1 px, 160 KB)

At a minimum, before we change any variable values, we should entirely separate legacy Vector CSS from modern Vector CSS because we risk making accidental changes to legacy Vector otherwise.

cc: @Volker_E because I think he'd find this interesting 😉

As part of this investigation, we want to know at what variables we're currently using and why.

Current variables in vector.

@font-size-base
@font-size-base--trident-hack
@font-size-heading-2
@font-size-sticky-header-links
@font-size-tabs
@font-size-user-links
@font-size-browser

Usage can be seen here.


Typography Scale Suggestion: Follow Codex

Current Codex Scale

font-size-x-small: 0.75em (Extra Small)
font-size-small: 0.875em (Small)
font-size-medium: 1em (Medium)
font-size-large: 1.125em (Large)
font-size-x-large: 1.25em (Extra Large)
font-size-xx-large: 1.5em (Double Extra Large)
font-size-xxx-large: 1.75em (Triple Extra Large)

Each font size is expressed as a multiple of the base font size (16px).

Caveat: codex scale is in em.


Answers to List of Questions

Where are we using raw values?

File NameLine NumberClass Name/IDFont Sizes
resources/skins.vector.styles/layouts/screen.less96#contentSub284%
resources/skins.vector.styles/components/TableOfContents.less35.vector-toc-toggle0.75em
resources/skins.vector.styles/components/Icon.less8.cdx-mixin-css-icon-alignment( )14px

Where are we already using tokens?

File NameLine NumberClass Name/IDFont Sizes
resources/skins.vector.styles/components/PageTitlebar.less29.vector-page-titlebar-toc.ve-active@font-size-base
resources/skins.vector.styles/components/TableOfContents.less18.vector-toc@font-size-base
resources/skins.vector.styles/components/LanguageDropdown.less30.vector-dropdown-label-text@font-size-base

Where are we already using rems?

File NameLine NumberClass Name/IDFont Sizes
resources/skins.vector.styles/components/PinnableHeader.less18.vector-pinnable-header-labelunit( 14 / @font-size-browser, rem )
resources/skins.vector.styles/components/Header.less29.search-toggleunit( 16 / @font-size-browser, rem )

What variables do we need?
We need variables for the raw values (see above raw values table)
What values aren't tied that should be?
None in skins.vector.styles (?) but common/variables.less has heading level styles that are defined separately without a consistent pattern.
What values are tied that shouldn’t be /happen to be currently assuming the same value?
None
What is the full range of size values we have?
(See ticket description)
Where are we overriding the base font size?
See above

I've spun out T345766 from this investigation in order address the interdependence between legacy and modern vector CSS.

Since as @KSarabia-WMF mentions above, we're using lots of non-standard values in the CSS, such as 84% I wanted to see what the values actually compute too. By pasting this Gist into the web console, we're able to get a sense of where non-standard values could pose an issue in Vector.

The image below highlights computed font-size values that are either 13px or decimal values (e.g. 13.3333px):

Screenshot 2023-09-11 at 10.57.31 AM.png (1×3 px, 1 MB)
Screenshot 2023-09-11 at 10.57.46 AM.png (2×4 px, 2 MB)

The biggest area that uses non-standard values is the toolbar, which has a font-size of 13px. We should standardize that area to 14px since it contains a lot of complexity -- the font-size is set to 13px on a parent elements but then back to 14px on the child elements.

Thanks @Jdrewniak - that seems enough to sign this off!