Page MenuHomePhabricator

Font modes: Test revised Codex type scale and font modes
Closed, ResolvedPublic5 Estimated Story Points

Description

Background

Per the work done as a part of this epic, we should

  • build an empty page with only the type scale with various modes to test the revised type scale and font modes in a more controlled environment.
  • test in MediaWiki and
  • provide the coming change and test results with Web and maybe other teams to ensure awareness ahead

Product and dev notes

While at normal scale the change should have barely any impact, there's one intended exceptions

  • line-height is going to be changing slightly "by a negligible amount" across the board.
Lookup table of value changes
Design token Less varOLD: currentNEW: default (medium)smalllargex-large
@font-size-x-small0.75rem0.75rem0.625rem0.875rem1rem
@font-size-small0.875rem0.875rem0.75rem1rem1.125rem
@font-size-medium1rem1rem0.875rem1.125rem1.25rem
@font-size-large1.125rem1.125rem1rem1.25rem1.375rem
@font-size-x-large1.25rem1.25rem1.125rem1.375rem1.5rem
@font-size-xx-large1.5rem1.5rem1.375rem1.625rem1.75rem
@font-size-xxx-large1.75rem1.75rem1.625rem1.875rem2rem
@line-height-xxx-small1.251.25rem1.125rem1.375rem1.625rem
@line-height-xx-small1.3751.375rem1.25rem1.625rem1.75rem
@line-height-x-smallnone1.4285714rem1.125rem1.625rem1.75rem
@line-height-small1.57142851.5714285rem1.25rem1.75rem1.875rem
@line-height-medium1.61.625rem1.375rem1.75rem1.875rem
@line-height-largenone1.75rem1.625rem1.875rem2rem
@line-height-x-largenone1.875rem1.75rem2rem2.125rem
@line-height-xx-largenone2.125rem2rem2.25rem2.375rem
@line-height-xxx-largenone2.375rem2.25rem2.5rem2.625rem

E.g. line-height-medium occurrences in our codebases

MediaWiki environment

A PatchDemo with pixel comparison test of at least

  1. Special:Preferences
  2. Special:ContentTranslation
  3. Special:Block with Multiblocks enabled (see T387983)
  4. two articles pages, with decent Template usage

Acceptance criteria

Sandbox
  • Provide visual sample of this pages hierarchy/design
  • Type page with font mode switcher is created
  • Type page is reviewed and any issues are noted
  • Set up appearance menu to mimic Vector text size switcher and test all components at different sizes
MediaWiki
  • A Patchdemo instance is set up with the font modes patch included
  • Review the following and note any issues
    • Special:Preferences (OOUI; no changes)
    • Special:ContentTranslation
    • Multiblocks (one issue found; commented on font modes patch)
    • MediaSearch (no issues found)
    • Two article pages (no issues found)
    • QuickSurveys (slight issues found with scaling)
    • NearbyPages (no issues found)
    • A Codex message box on an article page (no issues found)
    • MinervaNeue
    • Monobook, see T392253
  • As teams to test features that heavily use Codex that we can't easily test ourselves
    • Wikifunctions, see T390235
    • Something from Growth
Pixel
  • Pixel tests are reviewed once the font modes patch is merged and any issues are noted in tasks
Issues found during review

Checking these indicates we've created a separate task for them:

  • Updated tokens break Less calculations (T389116)
  • Slight scaling issue with checkboxes in QuickSurveys (T391890)
  • Accordion action button misaligned (T392636)
  • Accordion arrow shrinks (T392612)
  • Dialog spacing off (T392695)
  • Popover spacing off (T392733)

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Volker_E renamed this task from Create empty page to test revised Codex type scale and font modes to Test revised Codex type scale and font modes.Mar 11 2025, 4:01 PM
Volker_E updated the task description. (Show Details)

Noting a real example to test would be Multiblocks (T387983)

CCiufo-WMF lowered the priority of this task from High to Medium.Mar 12 2025, 6:04 PM

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

[design/codex@main] demos: Add typography demo Sandbox page

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

lwatson changed the point value for this task from 2 to 3.Mar 17 2025, 5:07 PM
CCiufo-WMF raised the priority of this task from Medium to High.Mar 17 2025, 5:07 PM
AnneT updated the task description. (Show Details)

I've created this patchdemo, but the Less errors documented in T389116 prevent it from being useful. Instead, you can try spinning up MediaWiki with your local version of Codex checked out to the font modes patch. You'll likely encounter some similar issues but you can fix them individually (by replacing the problematic Codex token with an equivalent em or rem value) to get Less compilation working again so you can move forward with testing.

I'll do this myself on Wednesday to test some special and article pages.

Change #1127236 merged by jenkins-bot:

[design/codex@main] demos: Add typography demo sandbox page

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

AnneT updated the task description. (Show Details)

@DTorsani-WMF / @Volker_E I found a couple of minor issues with QuickSurveys, which does scale with text size since it's in the article content.

First, at the large text size, the checkbox icon looks a bit weird since the box itself does not get larger. This is because its height and width are set to font-size-x-large, which does not scale in Vector.

Screenshot 2025-03-30 at 9.19.22 PM.png (564×586 px, 40 KB)

You can also see that the close button does not scale with the rest of the interface - it looks very small compared to the rest of the components. The reason is the same - the icon's width and height are set to font-size-x-large.

I'm curious to know your thoughts on these issues. We should at least run them by the Web team to see if they think this is an acceptable experience until font modes are implemented in skins.

CCiufo-WMF renamed this task from Test revised Codex type scale and font modes to Font modes: Test revised Codex type scale and font modes.Mar 31 2025, 5:36 PM

For components used within Vector which are not excluded from the text size preferences, and use @font-size-medium or @line-height-medium, we will see some unintended design details. This will be most prevalent where an element which uses one of these tokens is among other elements which use other font-size and line-height tokens that do not scale. What we will see are unintended, disproportionate typographic hierarchy and visual balance.

Some places where these issues will appear are where text is paired with an icon that is size small or x-small, such as in Button, Card, MenuItem, Message, Label, Select, TextInput (and anything which wraps TextInput), and TextArea. The most broken being the TextArea with icon in large mode. TextArea is unique because the line-height of the text is wider, and the icon is designed to remain aligned with the first line of text. Though, I'm a bit confused why the height of the icon is the correct height in small and medium modes, but completely wrong in large mode.

Another place we will see issues is in binary inputs, including Checkbox, Radio, and ToggleSwitch. This is because the switch in each is meant to scale with the text, but doesn't because it uses different tokens from medium to control its proportionate scaling. In Checkbox, the checkmark scales but the box around it does not. The most broken here being the ToggleSwitch in small and large mode. This is because there are very specific calculations being used to perfectly position the switch and grip.

Lastly, hierarchically, we will see issues where multiple text sizes are being used, and only medium is scaling. This includes Card, Dialog, Popover, and Table.

None of these issues are ideal. However, I would say that the ToggleSwitch one is the most important to address, as it appears broken, not just visually imbalanced. We have discussed making the values controlling the switch and grip position a component token, so that would theoretically fix this issue. I would also suggest we look into what's going on with the TextArea icon. This seems like a bug.

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

[mediawiki/core@master] Update Codex from v1.21.1 to v1.22.0

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

Change #1133258 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v1.21.1 to v1.22.0

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

Another issue I have found, which I do feel leans on the more problematic side, is that where @font-size-medium is used with @line-height-small, which is in most components. Now, the problem comes in where the text wraps to a second line, and specifically in large mode. This is because the font-size is scaling but the line-height is remaining the same.

Another issue I have found, which I do feel leans on the more problematic side, is that where @font-size-medium is used with @line-height-small, which is in most components. Now, the problem comes in where the text wraps to a second line, and specifically in large mode. This is because the font-size is scaling but the line-height is remaining the same.

First guts reaction: Would this be handled differently with unitless line-heights? 🤓 Or resulting in the same issue?
(there's no perfect pixel control in a dynamic environment, more generally there's no perfect control whatsoever in a dynamic environment, it should be seen as acceptable for such massive change to have edge cases(!) that are not perfectly covered)

Unitless line-heights would cause similar problems. @AnneT is going to talk with Web about this issue to see what they think and how we should resolve it for now.

@Jdrewniak @JScherer-WMF @bwang We've been testing the font modes work and have identified a few issues related to the fact that only the --font-size-medium and --line-height-medium CSS custom properties scale via the Vector 22 text size switcher, yet other font-size and line-height tokens are also used throughout Codex components. We've mitigated some of the issues but wanted to run a couple of larger ones by you all.

Note that these issues will be resolved once font modes are fully integrated into Vector 22 (meaning the text size switcher will scale all font-size and line-height tokens). These issues will temporarily appear between when we deploy Codex 2.0, which contains the font mode changes, and when we integrate them into the Vector 22 text switcher.

Let me know if you'd like to discuss any of this synchronously!

QuickSurveys

The QuickSurveys UI scales with text size, and there are a couple of issues when only the medium tokens scale:

  1. For Checkboxes, the check mark scales but the box doesn't. At the large size, this means the check mark looks a bit too large for the box.
  2. The icon-only dismiss button does not scale, so it looks small at the large size.

Screenshot 2025-03-30 at 9.19.22 PM.png (564×586 px, 40 KB)

In the meantime, we could exclude QuickSurveys from scaling with text size to prevent these issues from appearing between when we release font modes in Codex and integrate them into the Vector 22 text size switcher. What do you think?

Messageboxes

Messages in the content pane also scale with the text size switcher. One issue we've found is that the text size scales, since it's set to @font-size-medium, but the line height does not as it's set to @line-height-small. Especially at the large text size, the line height is quite small:

image.png (534×846 px, 111 KB)

Again, we could exclude messageboxes in the content section from scaling for now. Let me know what you'd like us to do here.

Integrating font modes into Vector 22

As mentioned, all of these issues will be resolved once we use the new font modes in Vector 22 to handle text size switching. I've created a proof of concept (patch, patchdemo) showing this. Obviously, there'd be more work to do - for example, we'd need to prevent the header and sidebars from scaling with text size, and we'd need to use Codex tokens for things like heading font-size (currently the page title does not scale). This is just to plant the seed that integrating font modes into Vector 22 will resolve this weird in-between state, and we'd like to discuss a path toward this goal at some point.

Content Translation

Testing in Special:ContentTranslation involved comparing component behavior with and without font modes, focusing on the default font size component styling rather than the scaling behavior.

Local testing environment:

Findings
  • The dashboard includes Codex components such as CdxButton, CdxIcon, CdxSearchInput, CdxMessage, and CdxInfoChip.
  • No Less compilation errors found.
  • No appearance menu to switch font sizes in the user interface.
  • CdxMessage - the close button’s alignment is no longer vertically centered with other header elements. Notice the alignment shift with the start icon and text in the attached before/after screenshots.
BeforeAfter
CX CdxMessage before.png (496×1 px, 104 KB)
CX CdxMessage after.png (494×1 px, 104 KB)

Codex components in the dashboard are highlighted:

CX dashboard - highlight Codex.png (1×1 px, 177 KB)

@Jdrewniak @JScherer-WMF @bwang We've been testing the font modes work and have identified a few issues related to the fact that only the --font-size-medium and --line-height-medium CSS custom properties scale via the Vector 22 text size switcher, yet other font-size and line-height tokens are also used throughout Codex components. We've mitigated some of the issues but wanted to run a couple of larger ones by you all.

Note that these issues will be resolved once font modes are fully integrated into Vector 22 (meaning the text size switcher will scale all font-size and line-height tokens). These issues will temporarily appear between when we deploy Codex 2.0, which contains the font mode changes, and when we integrate them into the Vector 22 text switcher.

Let me know if you'd like to discuss any of this synchronously!

QuickSurveys

The QuickSurveys UI scales with text size, and there are a couple of issues when only the medium tokens scale:

  1. For Checkboxes, the check mark scales but the box doesn't. At the large size, this means the check mark looks a bit too large for the box.
  2. The icon-only dismiss button does not scale, so it looks small at the large size.

Screenshot 2025-03-30 at 9.19.22 PM.png (564×586 px, 40 KB)

In the meantime, we could exclude QuickSurveys from scaling with text size to prevent these issues from appearing between when we release font modes in Codex and integrate them into the Vector 22 text size switcher. What do you think?

Messageboxes

Messages in the content pane also scale with the text size switcher. One issue we've found is that the text size scales, since it's set to @font-size-medium, but the line height does not as it's set to @line-height-small. Especially at the large text size, the line height is quite small:

image.png (534×846 px, 111 KB)

Again, we could exclude messageboxes in the content section from scaling for now. Let me know what you'd like us to do here.

Integrating font modes into Vector 22

As mentioned, all of these issues will be resolved once we use the new font modes in Vector 22 to handle text size switching. I've created a proof of concept (patch, patchdemo) showing this. Obviously, there'd be more work to do - for example, we'd need to prevent the header and sidebars from scaling with text size, and we'd need to use Codex tokens for things like heading font-size (currently the page title does not scale). This is just to plant the seed that integrating font modes into Vector 22 will resolve this weird in-between state, and we'd like to discuss a path toward this goal at some point.

Thanks @AnneT for doing this testing! It makes sense to me to be safe and exclude problematic areas like messageboxes and quicksurveys.

so it sounds like the Web team should create a new task for integrating font modes into Vector 22? And that includes font size and line height for everything basically? do you have a sense of when this needs to be done by?

Thanks @bwang! I created T391890 to capture the work of excluding those UIs from scaling.

I went ahead and created T391891 to cover integrating font modes in Vector 22. This does include scaling all font-size, line-height, and size-icon tokens. There's no specific due date, but we'd like to at least start discussing this now so we can form a general plan for when we might tackle this. Please feel free to pose additional questions in either task!

@DTorsani-WMF / @Volker_E is the typography page part of this task done? I see that there is a typography page in the Sandbox but there's no font mode switcher.

@AnneT I'm actually unsure where @Volker_E ended up with the Sandbox type pages, so I will let him answer this one.