Skip to content

chore: Updating Text component "body" font sizes #31494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 10, 2025

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Apr 1, 2025

Description

This PR updates the Text component's "body" variants to match the large typography sizes as part of the brand evolution. This change improves accessibility and readability across the extension by making text larger and more legible for users.

Key changes:

  1. Implements larger font sizes for Text component "body" variants to match large typography scale
  • BodyLg: 16px18px
  • BodyMd: 14px16px
  • BodySm: 12px14px
  • BodyXs: 10px12px
  1. Any CSS overrides that set a static font size without using the Text component have not been updated. These can be reviewed and updated on a case-by-case basis. Image below shows 542 instances of custom font size overrides
    Screenshot 2025-04-02 at 11 31 18 AM
  2. Upgrades @metamask/design-tokens to version 7.0.0 which includes the new typography scale
  3. Updates font-family references design tokens CSS variables. See migration docs.

Related issues

Fixes: #31172

Manual testing steps

Testing inside the extension

  1. Build and run the extension locally
  2. Navigate through various pages and components to verify text sizes
  3. Check that all body text variants (xs, sm, md, lg) are now using the larger font size scale
  4. Verify that the text remains properly aligned and spaced in all UI components
  5. Ensure no layout shifts or overflow issues are introduced by the larger text sizes

Testing the Text component in Storybook:

  1. Run Storybook with yarn storybook or open the build linked in this PR.
  2. Navigate to the Text component’s Variant story.
  3. Resize the window to confirm that the "body" variants maintain their size regardless of window dimensions.

Screenshots/Recordings

Before

Navigating around the extension in popup view using a base 14px font size

before720.mov

Text component in Storybook all "body" variants change sizes in smaller/larger viewports

beforesb720.mov

After

Navigating around the extension resize Text components work as expected

after720.mov

Text component in Storybook all "body" variants stay the same size regardless of window size

aftersb720.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Apr 1, 2025
@georgewrmarshall georgewrmarshall self-assigned this Apr 1, 2025
Copy link
Contributor

github-actions bot commented Apr 1, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

socket-security bot commented Apr 1, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub ↗.

Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@metamask/[email protected] ⏵ 7.0.092 +110010097 +2100

View full report ↗

@georgewrmarshall georgewrmarshall changed the title chore: upgrading design tokens and default font size to 16px chore: changing default font size 14px => 16px Apr 1, 2025
@georgewrmarshall georgewrmarshall force-pushed the fix/font-size-increase branch from 66b28b3 to 2986273 Compare April 1, 2025 20:36
@metamaskbot
Copy link
Collaborator

metamaskbot commented Apr 1, 2025

✨ Files requiring CODEOWNER review ✨

🎨 @MetaMask/design-system-engineers

  • ui/components/component-library/text/text.scss

🫰 @MetaMask/snaps-devs

  • test/e2e/snaps/test-snap-ethprovider.spec.js
  • test/e2e/snaps/test-snap-revoke-perm.spec.js

🖥️ @MetaMask/wallet-ux

  • ui/css/design-system/_typography.scss

@georgewrmarshall georgewrmarshall force-pushed the fix/font-size-increase branch from 2986273 to dfc7ea2 Compare April 1, 2025 20:41
@georgewrmarshall georgewrmarshall force-pushed the fix/font-size-increase branch 2 times, most recently from 74b45c7 to f5a8b4c Compare April 1, 2025 21:01
@@ -2,5 +2,5 @@
export const metamaskStorybookTheme = {
brandTitle: 'MetaMask Storybook',
// Typography
fontBase: 'var(--font-family-sans)',
fontBase: 'var(--font-family-default)', // from @metamask/design-tokens stylesheet
Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing removed --font-family-sans with --font-family-default as per the migration guide

Have also done a check to ensure there are no remaining instances of --font-family-sans in the codebase

Screenshot 2025-04-01 at 2 01 50 PM

@@ -265,7 +265,7 @@
"@metamask/browser-passworder": "^4.3.0",
"@metamask/contract-metadata": "^2.5.0",
"@metamask/controller-utils": "^11.4.0",
"@metamask/design-tokens": "^6.0.1",
"@metamask/design-tokens": "^7.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,6 +1,6 @@
@use "sass:map";

$font-family: var(--font-family-sans); // --font-family-sans from @metamask/design-tokens stylesheet
$font-family: var(--font-family-default); // from @metamask/design-tokens stylesheet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing removed --font-family-sans with --font-family-default as per the migration guide

@georgewrmarshall georgewrmarshall force-pushed the fix/font-size-increase branch from f5a8b4c to 5013598 Compare April 2, 2025 17:40
@georgewrmarshall georgewrmarshall force-pushed the fix/font-size-increase branch from 5013598 to f4532de Compare April 2, 2025 17:43
Comment on lines +50 to +52
// wait and scroll if necessary
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');

Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These e2e tests are failing because the increased font size shifts the content downward, triggering the scrollbar and button visibility, which disables the Confirm button. Unlike other snap e2e tests, this test-snap-ethprovider.spec.js and test-snap-revoke-perm.spec.js don't check for the scrollbar. Adding that check here resolves the issue.

Screenshot 2025-04-02 at 10 29 29 AM

@georgewrmarshall georgewrmarshall marked this pull request as ready for review April 2, 2025 18:26
@georgewrmarshall georgewrmarshall requested review from a team as code owners April 2, 2025 18:26
@metamaskbot
Copy link
Collaborator

Builds ready [9e3c5e6]
UI Startup Metrics (1207 ± 72 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1207106016397212411310
load10509421486661142982
domContentLoaded10439381482661482978
domInteractive17134651626
firstPaint715801140407258985
backgroundConnect106516910
firstReactRender19155251923
getState10427678
initialActions001001
loadScripts824707127366849900
setupStore7515279
WebpackHomeuiStartup20651674256524121932535
load16101301197718417281949
domContentLoaded16031297195518117241933
domInteractive181273141457
firstPaint20364170916525894
backgroundConnect2911338352874
firstReactRender162533531138894
getState1332753689
initialActions512632634
loadScripts15961294193117817211906
setupStore316288642649
FirefoxBrowserifyHomeuiStartup13791184197515514071775
load12401071180314712751598
domContentLoaded12401070180214712741598
domInteractive9940197268898
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2417105102533
firstReactRender22194642329
getState7320378
initialActions0028301
loadScripts12171053176714512491576
setupStore6417267
WebpackHomeuiStartup15681371219117816162020
load13531184192316114191775
domContentLoaded13521184192316114191775
domInteractive9838216279296
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect26195162743
firstReactRender35295243743
getState8438689
initialActions102112
loadScripts13291162189716113931753
setupStore7519289
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0%)
  • ui: 174 Bytes (0%)
  • common: -1 Bytes (0%)

@georgewrmarshall georgewrmarshall changed the title chore: changing default font size 14px => 16px chore: Updating Text component default font sizes Apr 2, 2025
@georgewrmarshall georgewrmarshall changed the title chore: Updating Text component default font sizes chore: Updating Text component "body" font sizes Apr 2, 2025
brianacnguyen
brianacnguyen previously approved these changes Apr 2, 2025
vinnyhoward
vinnyhoward previously approved these changes Apr 2, 2025
Copy link
Contributor

@vinnyhoward vinnyhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Helpful comments as always

Copy link
Contributor

@hmalik88 hmalik88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from my comment, this will require a bit more time to review that the change isn't breaking any snap surfaces (I know we were using specific font sizes in at least a couple places and not sure if there was any discussion about the impact of this particular part of the redesign). Will leave another review by tomorrow.

@metamaskbot
Copy link
Collaborator

Builds ready [3634465]
UI Startup Metrics (1168 ± 54 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1168106913735412041259
load1019930118147956995
domContentLoaded1013907117748951991
domInteractive16134251528
firstPaint7031411181396261990
backgroundConnect106596810
firstReactRender19143941931
getState11433768
initialActions001001
loadScripts80269395048832881
setupStore7518278
WebpackHomeuiStartup20951678259823522692538
load16441298212918717571985
domContentLoaded16381295212418517481965
domInteractive171267121454
firstPaint1897338258230382
backgroundConnect3311339462759
firstReactRender182533481148696
getState9322579
initialActions317135
loadScripts16271292195617717401926
setupStore236260462609
FirefoxBrowserifyHomeuiStartup13611154203214713911725
load12261044186514112661556
domContentLoaded12261044186514112661556
domInteractive10035198299096
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2417107112434
firstReactRender22183032427
getState6415278
initialActions001001
loadScripts12021027184213712421524
setupStore6430367
WebpackHomeuiStartup15371328218716915791949
load13261160198215413761701
domContentLoaded13261160198215413761701
domInteractive9744182249198
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25185262743
firstReactRender35287663744
getState8442689
initialActions002111
loadScripts13031141196315313501673
setupStore8531579
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0%)
  • ui: -3 Bytes (0%)
  • common: -220 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [5a8f65f]
UI Startup Metrics (1246 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1246111713615712901343
load10889361203601147984
domContentLoaded10829301198611142983
domInteractive17136081633
firstPaint8171501204407229953
backgroundConnect107294910
firstReactRender2115142152028
getState13533679
initialActions001001
loadScripts82868094160878929
setupStore8423379
WebpackHomeuiStartup21291664253018322512392
load16581306199414917321960
domContentLoaded16491303197814317261916
domInteractive171270121454
firstPaint158643966118973
backgroundConnect3511391523558
firstReactRender163533711056192
getState1843094279
initialActions316145
loadScripts16371299195513717171893
setupStore29632155318
FirefoxBrowserifyHomeuiStartup13821189194515914421754
load12341065176514113111573
domContentLoaded12341065176514113111573
domInteractive10338309418898
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect24175262538
firstReactRender23196252431
getState1342213389
initialActions002001
loadScripts12121041172813912921545
setupStore6430467
WebpackHomeuiStartup15321337229417115941918
load13181140204515913651691
domContentLoaded13181140204415913651691
domInteractive10051207269198
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25184652737
firstReactRender37286163948
getState9432689
initialActions102111
loadScripts12941119201915813421665
setupStore8553589
Bundle size diffs
  • background: 1 Bytes (0%)
  • ui: 174 Bytes (0%)
  • common: -1 Bytes (0%)

@brianacnguyen
Copy link
Contributor

I have read the CLA Document and I hereby sign the CLA

@metamaskbot
Copy link
Collaborator

Builds ready [7952774]
UI Startup Metrics (1230 ± 54 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1230111213655412581339
load10839791215511132994
domContentLoaded10789761209501125988
domInteractive17133351629
firstPaint696911218438221289
backgroundConnect96192910
firstReactRender19143741927
getState12533779
initialActions001001
loadScripts82973196148861917
setupStore7518278
WebpackHomeuiStartup22691893258017123952537
load18181429227517318692178
domContentLoaded18121426227217218662175
domInteractive17136391434
firstPaint162653266127187
backgroundConnect4714361564364
firstReactRender152553401056493
getState2733536569
initialActions317136
loadScripts18011422226817018572159
setupStore2472133478
FirefoxBrowserifyHomeuiStartup13901214197811714441612
load12421088182811512981466
domContentLoaded12421088182811512971465
domInteractive10338210289198
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25176082549
firstReactRender23195452332
getState7417289
initialActions001001
loadScripts12191059180611512741442
setupStore942322368
WebpackHomeuiStartup15391349183711216181776
load13301167159710614211555
domContentLoaded13301167159710614211554
domInteractive9536215279098
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25188082639
firstReactRender35275553843
getState9332689
initialActions002111
loadScripts13081146157410613991532
setupStore8523389

@metamaskbot
Copy link
Collaborator

Builds ready [7952774]
UI Startup Metrics (1224 ± 62 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1224109115046212601323
load10709561259531133993
domContentLoaded10659471256531129989
domInteractive16134451628
firstPaint705711143421249977
backgroundConnect96262910
firstReactRender21154772041
getState13535878
initialActions001001
loadScripts81870098851844886
setupStore8427379
WebpackHomeuiStartup21331694256218422662380
load16721306204016117631968
domContentLoaded16661301203516017591961
domInteractive171266121455
firstPaint169613946826187
backgroundConnect37103525032361
firstReactRender161533591076093
getState2533236079
initialActions318135
loadScripts16571296200415617521930
setupStore19620020528
FirefoxBrowserifyHomeuiStartup13471157173012114101594
load12101024161312012681462
domContentLoaded12091024161312012681462
domInteractive9937199299098
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect251665102451
firstReactRender21184032130
getState7336478
initialActions001001
loadScripts11871007159411912461439
setupStore7464667
WebpackHomeuiStartup15161357187110815681770
load13031150162610313511555
domContentLoaded13021150162510313511555
domInteractive9242175228896
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2818311292639
firstReactRender36277973848
getState9433689
initialActions104111
loadScripts1277112815539813251500
setupStore8547579

Copy link
Contributor

@hmalik88 hmalik88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, checked all snap surfaces that use Text.

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Apr 10, 2025
Merged via the queue into main with commit 603b661 Apr 10, 2025
300 of 301 checks passed
@georgewrmarshall georgewrmarshall deleted the fix/font-size-increase branch April 10, 2025 01:33
@github-actions github-actions bot locked and limited conversation to collaborators Apr 10, 2025
@metamaskbot metamaskbot added the release-12.17.0 Issue or pull request that will be included in release 12.17.0 label Apr 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.17.0 Issue or pull request that will be included in release 12.17.0 team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EXT]: Update typography variants to reflect new font size
5 participants