Skip to content

Conversation

@smgv
Copy link
Contributor

@smgv smgv commented Nov 20, 2025

Description

Open in GitHub Codespaces

This PR improves the useTheme hook implementation to provide more robust theme resolution and updates the unlock page logo to properly respond to theme changes.

1. Enhanced useTheme Hook (ui/hooks/useTheme.ts)

  • Refactored theme resolution logic into a separate resolveTheme() function for better code organization and testability
  • Improved fallback mechanism with the following priority:
    1. User's explicit theme setting (light or dark)
    2. System theme when "OS" is selected
    3. Document theme attribute on initial load
    4. System preference as final fallback

2. Unlock Page Logo Component (ui/pages/unlock-page/)

  • Created new MetaMaskWordmarkLogo component that responds to theme changes
  • Updated styles to properly display logo based on theme
  • Integrated useTheme hook for dynamic theme-aware rendering

3. Test Snapshots Updates

Updated Jest snapshots to reflect the new consistent theme behavior:

  • ui/components/multichain-accounts/smart-contract-account-toggle/__snapshots__/smart-contract-account-toggle.test.tsx.snap
  • ui/components/multichain/network-list-menu/__snapshots__/network-list-menu.test.tsx.snap
  • ui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snap
  • ui/pages/settings/security-tab/__snapshots__/security-tab.test.js.snap

Why snapshots changed:
The improved useTheme hook now properly resolves to light theme by default in tests (instead of undefined), causing ToggleButton components to consistently render with light theme colors (rgb(183, 187, 200) = #b7bbc8 = lightTheme.colors.icon.muted).

Changelog

CHANGELOG entry: Updated useTheme hook and logo for unlock page

Related issues

Fixes:

Manual testing steps

  1. Open Extension
  2. Create Wallet
  3. Lock Wallet
  4. Validate the changes

Screenshots/Recordings

Before

After

Screen.Recording.2025-11-20.at.2.53.01.PM.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.

Note

Refactors useTheme for reliable light/dark resolution and updates the unlock page wordmark logo to respond to theme, with minor CSS tweaks and snapshot updates.

  • Hooks:
    • useTheme: Extracts resolveTheme(settingTheme) with clear priority (explicit setting > OS when selected > document on initial load > system), validates against validThemes, warns and defaults to light if invalid; initializes state via resolver and applies on setting changes.
  • Unlock Page UI:
    • New MetamaskWordmarkLogo: Uses useTheme and renders MetaFoxHorizontalLogo with theme awareness; replaces direct logo usage in unlock-page.component.js.
    • Styles: Adjusts unlock-page__mascot-container__horizontal-logo--popup margins with responsive override.
  • Tests:
    • Snapshot updates across settings and multichain components reflecting consistent toggle colors (e.g., off rgb(183, 187, 200), on rgb(68, 89, 255)).

Written by Cursor Bugbot for commit 839eae4. This will update automatically on new commits. Configure here.

@smgv smgv self-assigned this Nov 20, 2025
@smgv smgv added area-onboarding needs-qa Label will automate into QA workspace team-onboarding Onboarding team labels Nov 20, 2025
@github-actions
Copy link
Contributor

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.

@smgv smgv requested a review from a team as a code owner November 20, 2025 11:13
@metamaskbot
Copy link
Collaborator

metamaskbot commented Nov 20, 2025

✨ Files requiring CODEOWNER review ✨

🔑 @MetaMask/accounts-engineers (2 files, +7 -7)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain-accounts/
        • 📁 smart-contract-account-toggle/
          • 📁 __snapshots__/
            • 📄 smart-contract-account-toggle.test.tsx.snap +3 -3
        • 📁 smart-contract-account-toggle-section/
          • 📁 __snapshots__/
            • 📄 smart-contract-account-toggle-section.test.tsx.snap +4 -4

👨‍🔧 @MetaMask/core-extension-ux (1 files, +2 -2)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain/
        • 📁 network-list-menu/
          • 📁 __snapshots__/
            • 📄 network-list-menu.test.tsx.snap +2 -2

@metamaskbot
Copy link
Collaborator

Builds ready [bea787b]
UI Startup Metrics (1242 ± 88 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1242106015288813011398
load106391813698311161192
domContentLoaded105591513548211101183
domInteractive2414110192172
firstPaint597152124242210721183
backgroundConnect21819628713224243
firstReactRender28195173244
getState32156493749
initialActions103112
loadScripts845708113481901973
setupStore1163351123
numNetworkReqs1257821573
BrowserifyPower User HomeuiStartup18531525298425819752431
load99186117781649861466
domContentLoaded97685517601639681458
domInteractive34151773628147
firstPaint4938617743599011009
backgroundConnect2192002539225234
firstReactRender78391281383102
getState17312834642194267
initialActions105112
loadScripts77466115351607681254
setupStore2310115162961
numNetworkReqs1446927848184244
WebpackStandard HomeuiStartup788717103664809949
load60455581461615769
domContentLoaded60054880860611762
domInteractive231484171970
firstPaint23790779172203630
backgroundConnect1163161227
firstReactRender28203953137
getState291450103745
initialActions103112
loadScripts59754679958609752
setupStore1162941319
numNetworkReqs1257720573
WebpackPower User HomeuiStartup14331192250724215481971
load66958113971366631006
domContentLoaded6595751378135647998
domInteractive38163454830145
firstPaint260871401192238634
backgroundConnect1574771728
firstReactRender8148105118997
getState15512331634161259
initialActions103112
loadScripts6565731365132645989
setupStore22971143253
numNetworkReqs1547045563189295
FirefoxBrowserifyStandard HomeuiStartup12261030177413413041514
load103188612529211061217
domContentLoaded103088612479211011217
domInteractive58302393779135
firstPaint------
backgroundConnect3621174223686
firstReactRender21175342230
getState1169913920
initialActions102012
loadScripts100987311918510841167
setupStore11515717931
numNetworkReqs1157116659
BrowserifyPower User HomeuiStartup27431979382036928443579
load1194973170917012221568
domContentLoaded1193966170817012221567
domInteractive14932603121174484
firstPaint------
backgroundConnect2563212022923581037
firstReactRender89461701997122
getState28390935273230895
initialActions3110227
loadScripts1154954168816411801527
setupStore1288779186118675
numNetworkReqs1016221140119204
WebpackStandard HomeuiStartup14221278194511714751692
load1215106514729112821406
domContentLoaded1214106514719112821406
domInteractive60262313682128
firstPaint------
backgroundConnect3921123194281
firstReactRender27206472938
getState136147161240
initialActions103122
loadScripts1189104814178512511354
setupStore13588131232
numNetworkReqs1256516663
WebpackPower User HomeuiStartup28362215357229329973491
load13681107195817915011685
domContentLoaded13671106195817915011685
domInteractive13829617137135481
firstPaint------
backgroundConnect15725656164192588
firstReactRender86421852393127
getState29584926289365899
initialActions4048658
loadScripts13381092191217714551659
setupStore1195780185110648
numNetworkReqs986422942114211
📊 Page Load Benchmark Results

Current Commit: bea787b | Date: 11/20/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 992ms (±46ms) 🟢 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 687ms (±42ms) 🟢 | historical mean value: 725ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±10ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 992ms 46ms 958ms 1.33s 1.02s 1.33s
domContentLoaded 687ms 42ms 664ms 1000ms 717ms 1000ms
firstPaint 75ms 10ms 64ms 152ms 88ms 152ms
firstContentfulPaint 75ms 10ms 64ms 152ms 88ms 152ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 53 Bytes (0%)
  • ui: 769 Bytes (0.01%)
  • common: 20 Bytes (0%)

@smgv smgv requested a review from a team as a code owner November 20, 2025 11:51
@smgv smgv changed the title fix: updated useTheme hook and unlock page logo fix: Improved useTheme Hook and Unlock Page Logo Theme Handling Nov 20, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [6e878b9]
UI Startup Metrics (1236 ± 105 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12361071162610513131429
load105387313269511281232
domContentLoaded104486513099611231226
domInteractive251498192184
firstPaint5417713184039791178
backgroundConnect21619531816220243
firstReactRender281893113346
getState311475103552
initialActions104112
loadScripts8366561075969171012
setupStore1162731216
numNetworkReqs1257821576
BrowserifyPower User HomeuiStartup18631561263526520672385
load98287015721679821492
domContentLoaded96686215571629611446
domInteractive36151934030159
firstPaint61314616034069191433
backgroundConnect22019428814225250
firstReactRender81451321688116
getState17912832844199291
initialActions104112
loadScripts76366013381607601239
setupStore211067112840
numNetworkReqs1447131453176274
WebpackStandard HomeuiStartup799733105471823967
load60755182061613771
domContentLoaded60254880660609765
domInteractive231589162069
firstPaint23173822174213605
backgroundConnect1253381529
firstReactRender28204263337
getState291475103645
initialActions104113
loadScripts59954679658607754
setupStore1242751422
numNetworkReqs1257620570
WebpackPower User HomeuiStartup14341188230822915811941
load6695751284125672998
domContentLoaded6585681268123658988
domInteractive34161683429125
firstPaint2621091051193241661
backgroundConnect1573261827
firstReactRender8045117128596
getState15412429331164230
initialActions103112
loadScripts6555661255121656974
setupStore24973153359
numNetworkReqs1547031256193281
FirefoxBrowserifyStandard HomeuiStartup12731041171913513451550
load106688813739411321219
domContentLoaded106488313739411321218
domInteractive63312114382172
firstPaint------
backgroundConnect43221652842109
firstReactRender22183842330
getState1167281021
initialActions103012
loadScripts104287313418911061196
setupStore136233231030
numNetworkReqs1257317763
BrowserifyPower User HomeuiStartup27121871385740129063610
load1183953161717812241517
domContentLoaded1181953161717812241517
domInteractive14331534121161448
firstPaint------
backgroundConnect262261134298371926
firstReactRender905215019101128
getState23288918238173871
initialActions318237
loadScripts1143938159517511911490
setupStore128586620595765
numNetworkReqs96572184294207
WebpackStandard HomeuiStartup14571268192113915241763
load12401049150110813171474
domContentLoaded12401049150110813171473
domInteractive73212324498147
firstPaint------
backgroundConnect4121196234390
firstReactRender282082103041
getState1264791243
initialActions103022
loadScripts12151035147110412911428
setupStore146183191234
numNetworkReqs1257217664
WebpackPower User HomeuiStartup28591998375232029953482
load13911170188218415441739
domContentLoaded13901169188218315441738
domInteractive12529554126132488
firstPaint------
backgroundConnect18327833188193608
firstReactRender88382032799128
getState27886912257381836
initialActions515511342
loadScripts13511097184818114631714
setupStore1525830230117756
numNetworkReqs99672214394208
📊 Page Load Benchmark Results

Current Commit: 6e878b9 | Date: 11/20/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 981ms (±45ms) 🟢 | historical mean value: 1.03s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 683ms (±62ms) 🟢 | historical mean value: 721ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 86ms (±124ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 981ms 45ms 952ms 1.35s 1.01s 1.35s
domContentLoaded 683ms 62ms 654ms 1.26s 708ms 1.26s
firstPaint 86ms 124ms 60ms 1.32s 80ms 1.32s
firstContentfulPaint 86ms 124ms 60ms 1.32s 80ms 1.32s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 53 Bytes (0%)
  • ui: 769 Bytes (0.01%)
  • common: 20 Bytes (0%)

@LeVinhGithub LeVinhGithub added QA Passed and removed needs-qa Label will automate into QA workspace labels Nov 20, 2025
Copy link
Contributor

@LeVinhGithub LeVinhGithub left a comment

Choose a reason for hiding this comment

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

lgtm QA

Copy link
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

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

LGTM for accounts owned files

@chaitanyapotti chaitanyapotti added this pull request to the merge queue Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Nov 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2025
@smgv smgv added this pull request to the merge queue Nov 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [839eae4]
UI Startup Metrics (1223 ± 87 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1223108014768712901376
load103591112558411141184
domContentLoaded102990612388311061178
domInteractive241392172078
firstPaint4859712653999751161
backgroundConnect21319325010216233
firstReactRender2918211203045
getState31166293651
initialActions1010113
loadScripts824696103482902962
setupStore1153641220
numNetworkReqs1257721575
BrowserifyPower User HomeuiStartup18501551252224220092353
load1008874155116310281495
domContentLoaded99386615431609991469
domInteractive35162014125162
firstPaint5509315804079301450
backgroundConnect22320026512229252
firstReactRender79461381485100
getState16813033336181228
initialActions104112
loadScripts78667113361607981265
setupStore1995792636
numNetworkReqs90621973297177
WebpackStandard HomeuiStartup822741108671843978
load62556586567635812
domContentLoaded62056285966629798
domInteractive2514130212278
firstPaint22187797149220617
backgroundConnect1153971426
firstReactRender30206673439
getState301473113748
initialActions103111
loadScripts61756084863627789
setupStore1273041318
numNetworkReqs1257720568
WebpackPower User HomeuiStartup14521047245024515691990
load6755811317127685980
domContentLoaded6645731297126664970
domInteractive36173464330129
firstPaint296931034217298829
backgroundConnect1584262027
firstReactRender81521361387100
getState15912431137168255
initialActions103112
loadScripts6615711278123662960
setupStore231069133246
numNetworkReqs1386627948173262
FirefoxBrowserifyStandard HomeuiStartup12561093170411013051478
load105993512847711131190
domContentLoaded105893312837711121189
domInteractive61301933684136
firstPaint------
backgroundConnect4020134214182
firstReactRender22185562236
getState11673101131
initialActions102122
loadScripts103491612587310911162
setupStore11584111024
numNetworkReqs1257116662
BrowserifyPower User HomeuiStartup27221763364634729173463
load1185945163318613021573
domContentLoaded1184945163318613011573
domInteractive13232613127148451
firstPaint------
backgroundConnect19928937237231783
firstReactRender89391482195131
getState26485901262209869
initialActions2013227
loadScripts1149926158718212561545
setupStore122578719699725
numNetworkReqs90502114384197
WebpackStandard HomeuiStartup14301252204213614611719
load1216106815119512671419
domContentLoaded1215106815119512671419
domInteractive62272123881131
firstPaint------
backgroundConnect41202373042100
firstReactRender26213942936
getState136165211043
initialActions103122
loadScripts1191105514378612431364
setupStore1156391134
numNetworkReqs1256917663
WebpackPower User HomeuiStartup28422033361433630663537
load14121128204119816001728
domContentLoaded14111128204119815991728
domInteractive12831503116144430
firstPaint------
backgroundConnect14718728155178572
firstReactRender85401341995118
getState28683915281326883
initialActions3131337
loadScripts13771106192819015411695
setupStore1145788179101651
numNetworkReqs885321240116172
📊 Page Load Benchmark Results

Current Commit: 839eae4 | Date: 11/21/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±40ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 719ms (±36ms) 🟢 | historical mean value: 727ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±13ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 40ms 1.01s 1.32s 1.07s 1.32s
domContentLoaded 719ms 36ms 698ms 981ms 749ms 981ms
firstPaint 78ms 13ms 60ms 192ms 88ms 192ms
firstContentfulPaint 78ms 13ms 60ms 192ms 88ms 192ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 53 Bytes (0%)
  • ui: 769 Bytes (0.01%)
  • common: 20 Bytes (0%)

@chaitanyapotti chaitanyapotti added this pull request to the merge queue Nov 21, 2025
Merged via the queue into main with commit cdd3cd7 Nov 21, 2025
176 checks passed
@chaitanyapotti chaitanyapotti deleted the fix/updated-usetheme-hook-for-logo branch November 21, 2025 12:09
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2025
@metamaskbot metamaskbot added the release-13.12.0 Issue or pull request that will be included in release 13.12.0 label Nov 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-onboarding QA Passed release-13.12.0 Issue or pull request that will be included in release 13.12.0 size-S team-onboarding Onboarding team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: MetaMask logo is missing on dark and light theme for unlock page on full screen extension when changing theme from pop up

6 participants