Skip to content

Commit 5cc3ed4

Browse files
chore(runway): cherry-pick chore: revert font preloader changes from #21199 (#22507)
- chore: revert font preloader changes from #21199 cp-7.59.0 (#22342) ## **Description** This PR reverts commit 74b8745 from PR #21199. **What is the reason for the change?** The font preloader changes introduced in #21199 are causing rendering bugs in the application: - Text is being cut off in various components - Font weights are not loading correctly - The comprehensive font preloading approach is causing unexpected layout issues **What is the improvement/solution?** This revert restores the previous variant-based font preloading approach, which: - Preloads only the specific TextVariant fonts that are actively used - Maintains stable font rendering without text cutoff issues - Ensures font weights load properly across all components - Restores the working implementation until the font loading issues can be properly addressed ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: #22301 Reverts: #21199 Original commit: 74b8745 ## **Manual testing steps** ```gherkin Feature: Font rendering after revert Scenario: user views text content across the app Given the user has the app running with the reverted font preloader And the user navigates through different screens with various text components When the user views text content in input fields, headings, and body text Then all text should be fully visible without cutoff And font weights should render correctly (regular, medium, bold) And there should be no layout shifting or text overflow issues ``` ## **Screenshots/Recordings** ### **Before** N/A - This is a revert PR ### **After** N/A - This is a revert PR ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Refactors font preloading to variant-based loading and updates text inputs to use theme fontWeight while removing hardcoded fontFamily, with snapshots adjusted accordingly. > > - **Fonts**: > - **FontPreloader**: Replace family-name list with variant-based preloading using `getFontFamily(TextVariant)`; on web load Regular/Medium/Bold; simplify native/web flows and logging. > - **Tests**: Rewrite `FontPreloader` tests to simpler, deterministic cases aligned with new preloader behavior. > - **Typography in inputs**: > - Add `fontWeight` from `theme.typography[textVariant]` in `Input.styles.ts`. > - Remove hardcoded `fontFamily` from styles in `Views/EnterPasswordSimple`, `Views/RevealPrivateCredential`, and `MultichainAccounts/PrivateKeyList` to rely on shared typography. > - **Snapshots**: > - Update across inputs to include `fontWeight: "400"` and drop `lineHeight` where applicable; reflect removed `fontFamily` in affected views. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 833bb0c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [84bd50b](84bd50b) Co-authored-by: George Marshall <george.marshall@consensys.net>
1 parent 19951ea commit 5cc3ed4

32 files changed

Lines changed: 275 additions & 612 deletions

File tree

app/component-library/components/Form/TextField/foundation/Input/Input.styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ const styleSheet = (params: { theme: Theme; vars: InputStyleSheetVars }) => {
4545
// Fix for placeholder text shifting with custom Geist fonts
4646
// Use minimal padding that works cross-platform with preloaded fonts
4747
paddingVertical: Platform.OS === 'ios' ? 2 : 1,
48-
// Ensure consistent line height for custom font baseline alignment
49-
lineHeight: Platform.OS === 'ios' ? 20 : 22,
48+
// Ensure consistent line height for custom font baseline alignment lineHeight: Platform.OS === 'ios' ? 20 : 22,
5049
fontFamily: getFontFamily(textVariant),
50+
fontWeight: theme.typography[textVariant].fontWeight,
5151
fontSize: theme.typography[textVariant].fontSize,
5252
letterSpacing: theme.typography[textVariant].letterSpacing,
5353
// iOS-specific fix for custom font baseline alignment

app/component-library/components/Form/TextField/foundation/Input/__snapshots__/Input.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ exports[`Input should render correctly 1`] = `
1414
"color": "#121314",
1515
"fontFamily": "Geist Regular",
1616
"fontSize": 16,
17+
"fontWeight": "400",
1718
"height": 24,
1819
"letterSpacing": 0,
19-
"lineHeight": 20,
2020
"opacity": 1,
2121
"paddingVertical": 2,
2222
"textAlignVertical": "center",

app/components/Snaps/SnapUIAddressInput/__snapshots__/SnapUIAddressInput.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ exports[`SnapUIAddressInput renders with an invalid CAIP Account ID 1`] = `
215215
"color": "#121314",
216216
"fontFamily": "Geist Regular",
217217
"fontSize": 16,
218+
"fontWeight": "400",
218219
"height": 46,
219220
"letterSpacing": 0,
220-
"lineHeight": 20,
221221
"opacity": 1,
222222
"paddingVertical": 2,
223223
"textAlignVertical": "center",

app/components/Snaps/SnapUIRenderer/__snapshots__/SnapUIRenderer.test.ts.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ exports[`SnapUIRenderer prefills interactive inputs with existing state 1`] = `
290290
"color": "#121314",
291291
"fontFamily": "Geist Regular",
292292
"fontSize": 16,
293+
"fontWeight": "400",
293294
"height": 46,
294295
"letterSpacing": 0,
295-
"lineHeight": 20,
296296
"opacity": 1,
297297
"paddingVertical": 2,
298298
"textAlignVertical": "center",
@@ -448,9 +448,9 @@ exports[`SnapUIRenderer re-renders when the interface changes 1`] = `
448448
"color": "#121314",
449449
"fontFamily": "Geist Regular",
450450
"fontSize": 16,
451+
"fontWeight": "400",
451452
"height": 46,
452453
"letterSpacing": 0,
453-
"lineHeight": 20,
454454
"opacity": 1,
455455
"paddingVertical": 2,
456456
"textAlignVertical": "center",
@@ -542,9 +542,9 @@ exports[`SnapUIRenderer re-renders when the interface changes 1`] = `
542542
"color": "#121314",
543543
"fontFamily": "Geist Regular",
544544
"fontSize": 16,
545+
"fontWeight": "400",
545546
"height": 46,
546547
"letterSpacing": 0,
547-
"lineHeight": 20,
548548
"opacity": 1,
549549
"paddingVertical": 2,
550550
"textAlignVertical": "center",
@@ -699,9 +699,9 @@ exports[`SnapUIRenderer re-syncs state when the interface changes 1`] = `
699699
"color": "#121314",
700700
"fontFamily": "Geist Regular",
701701
"fontSize": 16,
702+
"fontWeight": "400",
702703
"height": 46,
703704
"letterSpacing": 0,
704-
"lineHeight": 20,
705705
"opacity": 1,
706706
"paddingVertical": 2,
707707
"textAlignVertical": "center",
@@ -792,9 +792,9 @@ exports[`SnapUIRenderer re-syncs state when the interface changes 1`] = `
792792
"color": "#121314",
793793
"fontFamily": "Geist Regular",
794794
"fontSize": 16,
795+
"fontWeight": "400",
795796
"height": 46,
796797
"letterSpacing": 0,
797-
"lineHeight": 20,
798798
"opacity": 1,
799799
"paddingVertical": 2,
800800
"textAlignVertical": "center",
@@ -1941,9 +1941,9 @@ exports[`SnapUIRenderer supports fields with multiple components 1`] = `
19411941
"color": "#121314",
19421942
"fontFamily": "Geist Regular",
19431943
"fontSize": 16,
1944+
"fontWeight": "400",
19441945
"height": 46,
19451946
"letterSpacing": 0,
1946-
"lineHeight": 20,
19471947
"opacity": 1,
19481948
"paddingVertical": 2,
19491949
"textAlignVertical": "center",
@@ -2136,9 +2136,9 @@ exports[`SnapUIRenderer supports interactive inputs 1`] = `
21362136
"color": "#121314",
21372137
"fontFamily": "Geist Regular",
21382138
"fontSize": 16,
2139+
"fontWeight": "400",
21392140
"height": 46,
21402141
"letterSpacing": 0,
2141-
"lineHeight": 20,
21422142
"opacity": 1,
21432143
"paddingVertical": 2,
21442144
"textAlignVertical": "center",

app/components/Snaps/SnapUIRenderer/components/__snapshots__/form.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ exports[`SnapUIForm will render 1`] = `
144144
"color": "#121314",
145145
"fontFamily": "Geist Regular",
146146
"fontSize": 16,
147+
"fontWeight": "400",
147148
"height": 46,
148149
"letterSpacing": 0,
149-
"lineHeight": 20,
150150
"opacity": 1,
151151
"paddingVertical": 2,
152152
"textAlignVertical": "center",
@@ -362,9 +362,9 @@ exports[`SnapUIForm will render with fields 1`] = `
362362
"color": "#121314",
363363
"fontFamily": "Geist Regular",
364364
"fontSize": 16,
365+
"fontWeight": "400",
365366
"height": 46,
366367
"letterSpacing": 0,
367-
"lineHeight": 20,
368368
"opacity": 1,
369369
"paddingVertical": 2,
370370
"textAlignVertical": "center",

app/components/Snaps/SnapUIRenderer/components/__snapshots__/input.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ exports[`SnapUIInput handles disabled input 1`] = `
131131
"color": "#121314",
132132
"fontFamily": "Geist Regular",
133133
"fontSize": 16,
134+
"fontWeight": "400",
134135
"height": 46,
135136
"letterSpacing": 0,
136-
"lineHeight": 20,
137137
"opacity": 1,
138138
"paddingVertical": 2,
139139
"textAlignVertical": "center",
@@ -288,9 +288,9 @@ exports[`SnapUIInput renders with initial value 1`] = `
288288
"color": "#121314",
289289
"fontFamily": "Geist Regular",
290290
"fontSize": 16,
291+
"fontWeight": "400",
291292
"height": 46,
292293
"letterSpacing": 0,
293-
"lineHeight": 20,
294294
"opacity": 1,
295295
"paddingVertical": 2,
296296
"textAlignVertical": "center",

app/components/UI/Bridge/Views/BridgeView/__snapshots__/BridgeView.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ exports[`BridgeView Bottom Content blurs input when opening QuoteExpiredModal 1`
419419
"color": "#121314",
420420
"fontFamily": "Geist Regular",
421421
"fontSize": 40,
422+
"fontWeight": "400",
422423
"height": 50,
423424
"letterSpacing": 0,
424425
"lineHeight": 50,
@@ -802,6 +803,7 @@ exports[`BridgeView Bottom Content blurs input when opening QuoteExpiredModal 1`
802803
"color": "#121314",
803804
"fontFamily": "Geist Regular",
804805
"fontSize": 40,
806+
"fontWeight": "400",
805807
"height": 50,
806808
"letterSpacing": 0,
807809
"lineHeight": 50,
@@ -2078,6 +2080,7 @@ exports[`BridgeView renders 1`] = `
20782080
"color": "#121314",
20792081
"fontFamily": "Geist Regular",
20802082
"fontSize": 40,
2083+
"fontWeight": "400",
20812084
"height": 50,
20822085
"letterSpacing": 0,
20832086
"lineHeight": 50,
@@ -2461,6 +2464,7 @@ exports[`BridgeView renders 1`] = `
24612464
"color": "#121314",
24622465
"fontFamily": "Geist Regular",
24632466
"fontSize": 40,
2467+
"fontWeight": "400",
24642468
"height": 50,
24652469
"letterSpacing": 0,
24662470
"lineHeight": 50,

app/components/UI/Bridge/components/BridgeDestTokenSelector/__snapshots__/BridgeDestTokenSelector.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,9 @@ exports[`BridgeDestTokenSelector renders with initial state and displays tokens
867867
"color": "#121314",
868868
"fontFamily": "Geist Regular",
869869
"fontSize": 16,
870+
"fontWeight": "400",
870871
"height": 38,
871872
"letterSpacing": 0,
872-
"lineHeight": 20,
873873
"opacity": 1,
874874
"paddingVertical": 2,
875875
"textAlignVertical": "center",

app/components/UI/Bridge/components/BridgeSourceTokenSelector/__snapshots__/BridgeSourceTokenSelector.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,9 +872,9 @@ exports[`BridgeSourceTokenSelector renders with initial state and displays token
872872
"color": "#121314",
873873
"fontFamily": "Geist Regular",
874874
"fontSize": 16,
875+
"fontWeight": "400",
875876
"height": 38,
876877
"letterSpacing": 0,
877-
"lineHeight": 20,
878878
"opacity": 1,
879879
"paddingVertical": 2,
880880
"textAlignVertical": "center",

app/components/UI/Card/Views/CardAuthentication/__snapshots__/CardAuthentication.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,9 @@ exports[`CardAuthentication Component Login Step - Component Rendering matches l
658658
"color": "#121314",
659659
"fontFamily": "Geist Regular",
660660
"fontSize": 16,
661+
"fontWeight": "400",
661662
"height": 46,
662663
"letterSpacing": 0,
663-
"lineHeight": 20,
664664
"opacity": 1,
665665
"paddingVertical": 2,
666666
"textAlignVertical": "center",
@@ -771,9 +771,9 @@ exports[`CardAuthentication Component Login Step - Component Rendering matches l
771771
"color": "#121314",
772772
"fontFamily": "Geist Regular",
773773
"fontSize": 16,
774+
"fontWeight": "400",
774775
"height": 46,
775776
"letterSpacing": 0,
776-
"lineHeight": 20,
777777
"opacity": 1,
778778
"paddingVertical": 2,
779779
"textAlignVertical": "center",

0 commit comments

Comments
 (0)