Page MenuHomePhabricator

[EPIC] Typography: improve typography and allow for variable typography settings
Closed, ResolvedPublic

Description

Problem

There is a multitude of different small font sizes in the Vector 2022 skin ( a few large ones are inconsistent as well). From a design perspective, this undesirable because it affects the visual hierarchy of the page and adds to ambiguity in the design language.

From a technical perspective, this is undesirable because font-size units are used in other properties such as padding, heights etc, leading to inconsistencies across not just font-size, but spacing in general. This also makes it hard to calculate relative values like em's because of how font-sizes are inherited across elements.

MVP

Default and settings/variable font options
Changes must be applied at the least to:

  • Main (article) namespace content area
  • Main page

Optional

  • Font size variation for navigation
  • Font size variation across other content-style pages (Help namespace, Wikipedia namespace, etc)

No change

  • Special pages
  • History pages

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

Related Objects

StatusSubtypeAssignedTask
Resolvedovasileva
Resolvedovasileva
OpenJdrewniak
DuplicateSpikeNone
ResolvedBUG REPORTppelberg
ResolvedBUG REPORTTheresNoTime
Resolvedovasileva
ResolvedBUG REPORTovasileva
StalledNone
ResolvedJdlrobson
Resolvedppelberg
Resolvedovasileva
ResolvedJScherer-WMF
ResolvedJScherer-WMF
ResolvedJdrewniak
Resolvedovasileva
ResolvedJdrewniak
Resolvedovasileva
Resolvedovasileva
ResolvedJScherer-WMF
Resolvedovasileva
ResolvedNone
ResolvedBUG REPORTovasileva
Duplicateovasileva
ResolvedJScherer-WMF
ResolvedJScherer-WMF
ResolvedKSarabia-WMF
DuplicateJdlrobson
ResolvedJScherer-WMF
ResolvedJScherer-WMF
ResolvedJScherer-WMF
Resolvedovasileva
ResolvedNBaca-WMF
ResolvedEdtadros
ResolvedDesignJScherer-WMF
ResolvedJScherer-WMF
ResolvedNone
Resolvedovasileva
Resolvedovasileva
ResolvedNone
ResolvedSpikeJdrewniak
Resolvedbwang
Resolvedovasileva
ResolvedBUG REPORTJdlrobson
Resolvedovasileva
ResolvedDTorsani-WMF
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
ResolvedJdlrobson
Resolvedovasileva
Declinedovasileva
Resolvedovasileva
Resolvedovasileva
DuplicateNone
DuplicateBUG REPORTJdlrobson
Resolvedovasileva
ResolvedJdrewniak
Resolvedovasileva
ResolvedKSarabia-WMF
Resolvedjwang
ResolvedNone
DuplicateBUG REPORTJScherer-WMF
ResolvedBUG REPORTovasileva
ResolvedJdlrobson
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
DuplicateBUG REPORTJScherer-WMF
DuplicateBUG REPORTJScherer-WMF
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
Resolvedbwang
Resolvedjwang
ResolvedGMikesell-WMF
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
Resolvedovasileva
DeclinedNone
Resolvedovasileva
ResolvedJdrewniak
ResolvedBUG REPORTJdlrobson
ResolvedJScherer-WMF
ResolvedJScherer-WMF
Resolvedovasileva
ResolvedNone
Resolvedovasileva
DuplicateBUG REPORTNone
ResolvedNone
DuplicateNone

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Convert font sizes and applicable sizes to rem's instead of em's.

Note that the weaker task of converting sizes from px is not solved yet, for which reason users who have set a default font size to a value other than the default 16px (more than 3%, according to some research), often see proportions distorted, see T313225: [EPIC] Various parts of MediaWiki don't respect default browser font size.

@bmartinezcalvo @Sarai-WMDE can you add a comment here with the typographic scale you're working on (noting that it's still in progress), and include the mapping between the heading sizes you've defined and the corresponding ones in Wikitext/Visual editor? I will then follow up with a prototype that uses those sizes.

@bmartinezcalvo @Sarai-WMDE can you add a comment here with the typographic scale you're working on (noting that it's still in progress), and include the mapping between the heading sizes you've defined and the corresponding ones in Wikitext/Visual editor? I will then follow up with a prototype that uses those sizes.

Of course! The last version (v9) of the WIP typographic scale that we're defining as part of Codex is available in this Figma file. The scale is currently a work in progress and shouldn't be considered a prescription, just a proposal open to adjustments. The heading sizing is strongly based off of the Style guide styles.

Here's a table mapping of the current Wikitext/Visual editor styles and their potential equivalent style(s):

Wikitext/Visual editor styleCodex style (v9 typographic styles)Notes
Page title (h1, 28.8px/37.44px – 1.8em/1.3)Heading XL (32/40 – 2em/1.25)⚠️ Increase in size and line-height
Heading (h2, 21/27.3 – 1.3em/1.6)Heading L (24/30 – 1.5em/1.25)⚠️ Increase in size and line-height (Matches Minerva)
Sub-heading 1 (h3, 16.8px/26.88 – 1.2em/1.6)Heading M (20/25 – 1.25em/1.25)⚠️ Increase in size (matches Minerva approx.) and reduction in line-height
Sub-heading 2, 3, 4 (h4, 14px/22.4 – 100%/1.6)Heading XS (16/20 – 1em/1.25)⚠️ Increase in size and reduction in line-height. Subheading 2, 3, 4 seem to have the same font size
Paragraph (Vector body, 14/22.4 – calc(1em * 0.875)/1.6)Body S (14/22.4 – 0.875em/1.6)No differences
Preformatted (14px/18.2px – calc(1em * 0.875)/1.3)Code (14/22.4 – 0.875em/1.6)⚠️ Increase in line-height
Computer code (14px/22.4px – calc(1em * 0.875)/1.6)Code (14/22.4 – 0.875em/1.6)No differences
Block quote (blockquote, 14/22.4 – calc(1em * 0.875)/1.6)Body S (14/22.4 – 0.875em/1.6)No differences
Small (11.9px/19.04px – 85%/1.6)Small text (12/19.2 – 0.75em/1.6)⚠️ Increase in size and line-height
Big (16.8px/26.88px – larger/1.6)Body M (16/25.6 – 1em/1.6)⚠️ Decrease in size and line-height

Notes:

  • We tried to use system sizing values as much as possible (this is easier to do with font sizes in theory, but harder to achieve with line heights unless we use rem – which we're considering).
  • Font sizes are in em to allow for proper skin resizing, but they assume a 16px base, which will be incorrect in many contexts. We might need to use CSS functions – such as calc() or max() – to achieve the desired sizes. (I'm not sure if opting for rem would be an option in this case.)
  • The aim is consolidating text styles as much as possible: on the one hand, trying to unifying styles instead of reflecting the current diversity found in production + on the other hand, creating a single scale that can be applied to define content hierarchy on both desktop and mobile.
  • The scale fits the distinction between body (paragraph style, with increased line-height for enhanced legibility) and UI text (component text, convenient to keep elements sized properly)
  • The "Small text" style represents the smallest allowed text style in production, based on accessibility recommendations (Related task: T312245)
  • Superscript and Subscript styles haven't been defined as part of the Codex typographic styles yet

@Sarai-WMDE thanks so much for providing the specifications. I've created a prototype that allows us to see the proposed typographic scale for h1, h2, h3, h4, h5, and p elements. It does not yet include the changes for other elements (e.g. "computer code" or "small", listed in the table in the comment above).

Link to prototype: https://di-typography-update.web.app/Typography

Questions:

  • the line-height update on the h1 might not be having the desired effect — should it be getting more space between the h1 and the border beneath?
  • in both the current and proposed systems the h2s (serif) and h3s (sans) are quite similar in size. I wonder if the h2s should feel slightly larger than the h3s?

cc @Volker_E @bmartinezcalvo

@alexhollender_WMF thank you for creating this prototype to test our fonts in the article, this is great!

Some feedback about the Proposed prototype:

  1. H1 seems too big to me (at least with this combination of text sizes and paddings, maybe if the paddings are increased too it would be ok)
  2. The subtitle From Wikipedia, the free encyclopedia should be 12/19.2 instead according to our new Typography scale
  3. H3 Bold: I think with 18px Heading S would be enough since the title is already highlighted with Bold, so following the same proportional sizes 14-16px of the current article, I would use 16px for body text and 18px for h3. Also h3 with 20px seems a bit big to me.
  4. If we are increasing the size of the article text maybe we should also increase the spacing between the elements in the article (e.g. Header-Title, Title-Toolbar,...) since now that the article text it's bigger some parts of the article seem bunched up. Some screenshots of places where I detect the space between elements is not enough:
Captura de Pantalla 2022-08-25 a las 11.17.08.png (900×552 px, 384 KB)
Captura de Pantalla 2022-08-25 a las 11.16.06.png (1×2 px, 1 MB)
Padding in the info boxesSeparation between images and text in the article

Thanks so much, Alex!! The prototype is extremely useful! My take on the shared feedback:

  • Regarding h1:
    • Size: I was expecting for it to feel too big, indeed. The sweet spot might be at 28px, which would also be closer to Minerva
    • The main heading needs more space. I think the cause is that its wrapper (the div with the class header article-header) has a 40px height applied to it. We maybe could adjust that?
  • H3: We could jump one style and use Heading S (18px), yes.
  • Regarding spacing:
    • Agreed. It looks like we need to increase the global vertical spacing of the article together with the font, otherwise it really feels too dense and this even affects hierarchy. I quickly tried and changing the margin of the selector .mw-body-content p to 1em seems to do the trick overall, although we might need to apply specific bottom margins to the headings to maintains spacing when they're placed before anything that's not a <p>.
    • Thumbs and info boxes' paddings: these will also need to be adjusted. I hope we can use relative units too

@Sarai-WMDE @bmartinezcalvo thanks for the notes. I've updated the prototype (https://di-typography-update.web.app/Typography) with the following changes:

  • Decrease h1 from 32px to 28px
    • Note: this means the h1 size is decreasing — it is currently 28.8px in production
  • Remove height: 40px from h1 (though this doesn't have an effect, unless we increase the line height beyond 40px)
  • Decrease From Wikipedia... tagline from 12.8px to 12px
  • Decrease h3 from 20px to 18px
  • Increase spacing between all p elements from 0.5em to 1em
  • Increase the max-width on the content container from 960px to 1050px
    • Note: ultimately this will be controlled by the grid, and will be a controlled by the max-width of the main outer container

(Reminder to hard-refresh in order to see the changes)

That all looks pretty fine to me, all other points I see favorable.

Two things to consider:

  • I don't think that reducing From Wikipedia... tagline goes well with our community nor does it look harmonious to me.
  • The paragraph change is not in the prototype for me. 1em looks really good to me when updating myself via DOM Inspector.

Sorry, I'm a little confused. The main text in the table above (T313828#8179161) is 14 pixels, but in the prototype it is 16 pixels, where is the truth?

Jdlrobson renamed this task from Typography: Apply consistent font sizes across Vector 2022 to [EPIC] Typography: Apply consistent font sizes across Vector 2022.Nov 16 2022, 7:45 PM
Jdlrobson added projects: Epic, Web-Team-Backlog.
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Incoming to Epics/Goals on the Web-Team-Backlog board.

Hey @Iniquity. The table tried to list some of the main styles in production and provide their closer equivalent in the new typographic scale. All in order to validate the convenience of the new styles. I think that the body font size in the latest version of prototype is just an exploration of another initiative (the possibility of increasing the article body font size from 14px to 16px). This would be enabled by the system's styles if desired, but the final informed decision will need to be made by the Web team.

ovasileva renamed this task from [EPIC] Typography: Apply consistent font sizes across Vector 2022 to [EPIC] Typography: improve typography and allow for variable typography settings .Aug 31 2023, 1:52 PM
ovasileva updated the task description. (Show Details)

Resolving! Will track subtasks separately.