Skip to content

chore(6936): migrate core UI components from MUI v4 → v5#41955

Open
Copilot wants to merge 9 commits intomainfrom
copilot/migrate-core-ui-components-mui-v4-v5
Open

chore(6936): migrate core UI components from MUI v4 → v5#41955
Copilot wants to merge 9 commits intomainfrom
copilot/migrate-core-ui-components-mui-v4-v5

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

Migrates three legacy UI components off @material-ui/core (MUI v4) to @mui/material (MUI v5), replacing the JSS-based withStyles HOC pattern with the emotion-based sx prop.

Components changed

  • CancelButton — swap Tooltip import; rename positionplacement (v5 API change)
  • Slider — remove withStyles; move styles to sliderSx constant passed via sx; update &$active&.Mui-active; drop v4-specific thumb marginTop/marginLeft offsets (v5 uses transform); add border: 'none' to track to match v4 appearance (v5 adds a default border)
  • TextField — remove withStyles and the injected classes prop; refactor all three theme prop builders (material, material-white-padded, bordered) to return sx on InputLabelProps/InputProps instead of classes; update JSS &$className state selectors to MUI v5 globals (&.Mui-focused, &.Mui-error)

Style migration pattern

// Before (MUI v4 — JSS withStyles)
InputLabelProps: {
  classes: {
    root: materialLabel,      // '&$materialFocused': { color: '...' }
    focused: materialFocused, // empty marker class
  },
},

// After (MUI v5 — sx prop)
InputLabelProps: {
  sx: {
    '&.Mui-focused': { color: 'var(--color-text-alternative)' },
    '&.Mui-error':   { color: 'var(--color-text-alternative)' },
  },
},

Dependencies

Added @mui/material ^5.14.0, @emotion/react ^11.11.1, and @emotion/styled ^11.11.0 as direct dependencies (all three were already resolved transitively; this makes the relationship explicit).

Side-effect: eliminates 4 MUI v4 JSS console warnings previously emitted during slider unit tests.


Note

Medium Risk
Touches shared UI components and updates LavaMoat allowlists for new MUI v5/emotion dependency graphs, which could cause UI regressions or bundling/runtime policy breakage if misconfigured.

Overview
Migrates three legacy UI components (CancelButton, Slider, TextField) from @material-ui/core (MUI v4) to @mui/material (MUI v5), replacing withStyles/JSS styling with emotion sx styling and updating minor API differences (e.g., Tooltip positionplacement).

Updates depcheck ignores and broadens LavaMoat Browserify/Webpack policies (mv2/mv3; beta/experimental/flask/main) to allow the new @mui/material and @emotion/* dependency trees and required globals, while removing the old @material-ui/core>popper.js policy entries. Jest console baseline is adjusted to drop prior MUI JSS warning expectations for the slider tests.

Reviewed by Cursor Bugbot for commit 54c748d. Bugbot is set up for automated code reviews on this repo. Configure here.

- Update TextField: replace @material-ui/core imports with @mui/material,
  migrate withStyles/classes to sx prop, update JSS $class refs to .Mui-* classes
- Update Slider: replace @material-ui/core/Slider with @mui/material Slider,
  migrate withStyles to sx prop, update &$active to &.Mui-active, remove
  v4-specific thumb margin offsets
- Update CancelButton: replace @material-ui/core/Tooltip with @mui/material/Tooltip,
  rename position prop to placement
- Add @mui/material, @emotion/react, @emotion/styled as direct dependencies
- Update test console baseline (eliminates 4 prior MUI JSS warnings)

Agent-Logs-Url: https://github.com/MetaMask/metamask-extension/sessions/a8f2e4e8-7701-4c87-8974-60a38d7cc640

Co-authored-by: MajorLift <34228073+MajorLift@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate core UI components from MUI v4 to v5 feat: migrate core UI components from MUI v4 → v5 Apr 20, 2026
Copilot AI requested a review from MajorLift April 20, 2026 14:26
@MajorLift
Copy link
Copy Markdown
Contributor

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

Tip

Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers.
🧠 Learn how to read policy diffs: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

👀 lavamoat/browserify/beta/policy.json changes differ from main/policy.json policy changes
👀 lavamoat/browserify/experimental/policy.json changes differ from main/policy.json policy changes
👀 lavamoat/browserify/flask/policy.json changes differ from main/policy.json policy changes
👀 lavamoat/webpack/mv2/beta/policy.json changes differ from mv2/main/policy.json policy changes
👀 lavamoat/webpack/mv2/experimental/policy.json changes differ from mv2/main/policy.json policy changes
👀 lavamoat/webpack/mv2/flask/policy.json changes differ from mv2/main/policy.json policy changes
👀 lavamoat/webpack/mv3/beta/policy.json changes differ from mv3/main/policy.json policy changes
👀 lavamoat/webpack/mv3/experimental/policy.json changes differ from mv3/main/policy.json policy changes
👀 lavamoat/webpack/mv3/flask/policy.json changes differ from mv3/main/policy.json policy changes

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented Apr 20, 2026

✨ Files requiring CODEOWNER review ✨

📜 @MetaMask/policy-reviewers (12 files, +1840 -208)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +174 -18
      • 📁 experimental/
        • 📄 policy.json +174 -18
      • 📁 flask/
        • 📄 policy.json +174 -18
      • 📁 main/
        • 📄 policy.json +174 -18
    • 📁 webpack/
      • 📁 mv2/
        • 📁 beta/
          • 📄 policy.json +143 -17
        • 📁 experimental/
          • 📄 policy.json +143 -17
        • 📁 flask/
          • 📄 policy.json +143 -17
        • 📁 main/
          • 📄 policy.json +143 -17
      • 📁 mv3/
        • 📁 beta/
          • 📄 policy.json +143 -17
        • 📁 experimental/
          • 📄 policy.json +143 -17
        • 📁 flask/
          • 📄 policy.json +143 -17
        • 📁 main/
          • 📄 policy.json +143 -17

Tip

Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers.

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented Apr 20, 2026

Builds ready [e029c63]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 8 warn · 🔴 0 fail)

Baseline (latest main): 71bd826 | Date: 10/14/58243 | Pipeline: 24677858551 | Baseline logs

Interaction Benchmarks · Samples: 5
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -55%
  • loadNewAccount/total: -55%
  • bridgeUserActions/bridge_load_page: -10%
  • bridgeUserActions/bridge_load_asset_picker: -24%
  • bridgeUserActions/bridge_search_token: -21%
  • bridgeUserActions/total: -23%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.7s
  • 🟡 confirmTx/FCP: p75 2.7s
  • 🟡 bridgeUserActions/FCP: p75 2.8s
Startup Benchmarks · Samples: 100
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: -20%
  • startupStandardHome/domInteractive: +17%
  • startupStandardHome/initialActions: -33%
  • startupStandardHome/loadScripts: -13%
  • startupStandardHome/setupStore: +21%
  • startupStandardHome/numNetworkReqs: -37%
  • startupStandardHome/uiStartup: -20%
  • startupStandardHome/load: -15%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/firstPaint: -13%
  • startupStandardHome/backgroundConnect: -37%
  • startupStandardHome/firstReactRender: -23%
  • startupStandardHome/loadScripts: -14%
  • startupStandardHome/setupStore: -13%
  • startupStandardHome/numNetworkReqs: -44%
  • startupStandardHome/domInteractive: -43%
  • startupStandardHome/backgroundConnect: +11%
  • startupStandardHome/initialActions: +33%
  • startupStandardHome/numNetworkReqs: -34%
  • startupStandardHome/uiStartup: -14%
  • startupStandardHome/domInteractive: -44%
  • startupStandardHome/backgroundConnect: -13%
  • startupStandardHome/initialActions: +14%
  • startupStandardHome/setupStore: -54%
  • startupStandardHome/numNetworkReqs: -32%
User Journey Benchmarks · Samples: 5 · mock API
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/srpButtonToSrpForm: -85%
  • onboardingImportWallet/metricsToWalletReadyScreen: -49%
  • onboardingImportWallet/doneButtonToHomeScreen: -79%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +26%
  • onboardingImportWallet/total: -43%
  • onboardingNewWallet/srpButtonToPwForm: -77%
  • onboardingNewWallet/skipBackupToMetricsScreen: -68%
  • onboardingNewWallet/doneButtonToAssetList: -24%
  • onboardingNewWallet/total: -26%
  • assetDetails/assetClickToPriceChart: -14%
  • assetDetails/total: -14%
  • solanaAssetDetails/assetClickToPriceChart: -68%
  • solanaAssetDetails/total: -68%
  • importSrpHome/loginToHomeScreen: -11%
  • importSrpHome/openAccountMenuAfterLogin: -76%
  • importSrpHome/homeAfterImportWithNewWallet: -68%
  • importSrpHome/total: -61%
  • sendTransactions/openSendPageFromHome: +47%
  • sendTransactions/reviewTransactionToConfirmationPage: +37%
  • sendTransactions/total: +35%
  • swap/openSwapPageFromHome: -96%
  • swap/fetchAndDisplaySwapQuotes: +32%
  • swap/total: +11%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/INP: p75 280ms
  • 🟡 assetDetails/FCP: p75 2.6s
  • 🟡 solanaAssetDetails/FCP: p75 2.6s
  • 🟡 importSrpHome/FCP: p75 2.7s
  • 🟡 sendTransactions/INP: p75 280ms
  • 🟡 sendTransactions/FCP: p75 2.9s
  • 🟡 swap/FCP: p75 2.7s
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-browserify
dappPageLoad🟢 [Show logs]
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 65 Bytes (0%)
  • ui: 473.12 KiB (5.56%)
  • common: 46 Bytes (0%)

@DDDDDanica DDDDDanica changed the title feat: migrate core UI components from MUI v4 → v5 chore(6936): migrate core UI components from MUI v4 → v5 May 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

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.

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 1, 2026

Builds ready [9ef13df]
⚡ Performance Benchmarks (Total: 🟢 0 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): 71bd826 | Date: 10/14/58243 | Pipeline: 25217319673 | Baseline logs

Interaction Benchmarks · Samples: 5

⚠️ Missing data: chrome/webpack/interactionUserActions, firefox/webpack/interactionUserActions

✅ No regressions detected

Startup Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/startupStandardHome, chrome/webpack/startupPowerUserHome, firefox/webpack/startupStandardHome, firefox/webpack/startupPowerUserHome

✅ No regressions detected

User Journey Benchmarks · Samples: 5 · mock API

⚠️ Missing data: chrome/webpack/userJourneyOnboardingImport, chrome/webpack/userJourneyOnboardingNew, chrome/webpack/userJourneyAssets, chrome/webpack/userJourneyAccountManagement, chrome/webpack/userJourneyTransactions, firefox/webpack/userJourneyOnboardingImport, firefox/webpack/userJourneyOnboardingNew, firefox/webpack/userJourneyAssets, firefox/webpack/userJourneyAccountManagement, firefox/webpack/userJourneyTransactions

✅ No regressions detected

Dapp Page Load Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/pageLoadBenchmark

✅ No regressions detected

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 55 Bytes (0%)
  • ui: 472.74 KiB (5.47%)
  • common: 122 Bytes (0%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 6, 2026

Builds ready [df9d5dc]
⚡ Performance Benchmarks (Total: 🟢 0 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): 51036da | Date: 5/2/2026 | Pipeline: 25411380674 | Baseline logs

Interaction Benchmarks · Samples: 5

⚠️ Missing data: chrome/webpack/interactionUserActions, firefox/webpack/interactionUserActions

✅ No regressions detected

Startup Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/startupStandardHome, chrome/webpack/startupPowerUserHome, firefox/webpack/startupStandardHome, firefox/webpack/startupPowerUserHome

✅ No regressions detected

User Journey Benchmarks · Samples: 5 · mock API

⚠️ Missing data: chrome/webpack/userJourneyOnboardingImport, chrome/webpack/userJourneyOnboardingNew, chrome/webpack/userJourneyAssets, chrome/webpack/userJourneyAccountManagement, chrome/webpack/userJourneyTransactions, firefox/webpack/userJourneyOnboardingImport, firefox/webpack/userJourneyOnboardingNew, firefox/webpack/userJourneyAssets, firefox/webpack/userJourneyAccountManagement, firefox/webpack/userJourneyTransactions

✅ No regressions detected

Dapp Page Load Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/pageLoadBenchmark

✅ No regressions detected

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 54 Bytes (0%)
  • ui: 472.97 KiB (5.45%)
  • common: 143 Bytes (0%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 7, 2026

Builds ready [e43c1b8]
⚡ Performance Benchmarks (Total: 🟢 0 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): 51036da | Date: 5/2/2026 | Pipeline: 25493669880 | Baseline logs

Interaction Benchmarks · Samples: 5

⚠️ Missing data: chrome/webpack/interactionUserActions, firefox/webpack/interactionUserActions

✅ No regressions detected

Startup Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/startupStandardHome, chrome/webpack/startupPowerUserHome, firefox/webpack/startupStandardHome, firefox/webpack/startupPowerUserHome

✅ No regressions detected

User Journey Benchmarks · Samples: 5 · mock API

⚠️ Missing data: chrome/webpack/userJourneyOnboardingImport, chrome/webpack/userJourneyOnboardingNew, chrome/webpack/userJourneyAssets, chrome/webpack/userJourneyAccountManagement, chrome/webpack/userJourneyTransactions, firefox/webpack/userJourneyOnboardingImport, firefox/webpack/userJourneyOnboardingNew, firefox/webpack/userJourneyAssets, firefox/webpack/userJourneyAccountManagement, firefox/webpack/userJourneyTransactions

✅ No regressions detected

Dapp Page Load Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/pageLoadBenchmark

✅ No regressions detected

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 85 Bytes (0%)
  • ui: 472.66 KiB (5.47%)
  • common: 82 Bytes (0%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 7, 2026

Builds ready [ac2ee62]
⚡ Performance Benchmarks (Total: 🟢 0 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): 51036da | Date: 5/2/2026 | Pipeline: 25496015209 | Baseline logs

Interaction Benchmarks · Samples: 5

⚠️ Missing data: chrome/webpack/interactionUserActions, firefox/webpack/interactionUserActions

✅ No regressions detected

Startup Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/startupStandardHome, chrome/webpack/startupPowerUserHome, firefox/webpack/startupStandardHome, firefox/webpack/startupPowerUserHome

✅ No regressions detected

User Journey Benchmarks · Samples: 5 · mock API

⚠️ Missing data: chrome/webpack/userJourneyOnboardingImport, chrome/webpack/userJourneyOnboardingNew, chrome/webpack/userJourneyAssets, chrome/webpack/userJourneyAccountManagement, chrome/webpack/userJourneyTransactions, firefox/webpack/userJourneyOnboardingImport, firefox/webpack/userJourneyOnboardingNew, firefox/webpack/userJourneyAssets, firefox/webpack/userJourneyAccountManagement, firefox/webpack/userJourneyTransactions

✅ No regressions detected

Dapp Page Load Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/pageLoadBenchmark

✅ No regressions detected

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 85 Bytes (0%)
  • ui: 471.94 KiB (5.46%)
  • common: 82 Bytes (0%)

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ac2ee62. Configure here.

Comment thread ui/components/ui/text-field/text-field.component.js
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 7, 2026

Builds ready [54c748d]
⚡ Performance Benchmarks (Total: 🟢 0 pass · 🟡 0 warn · 🔴 0 fail)

Baseline (latest main): 51036da | Date: 5/2/2026 | Pipeline: 25508955326 | Baseline logs

Interaction Benchmarks · Samples: 5

⚠️ Missing data: chrome/webpack/interactionUserActions, firefox/webpack/interactionUserActions

✅ No regressions detected

Startup Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/startupStandardHome, chrome/webpack/startupPowerUserHome, firefox/webpack/startupStandardHome, firefox/webpack/startupPowerUserHome

✅ No regressions detected

User Journey Benchmarks · Samples: 5 · mock API

⚠️ Missing data: chrome/webpack/userJourneyOnboardingImport, chrome/webpack/userJourneyOnboardingNew, chrome/webpack/userJourneyAssets, chrome/webpack/userJourneyAccountManagement, chrome/webpack/userJourneyTransactions, firefox/webpack/userJourneyOnboardingImport, firefox/webpack/userJourneyOnboardingNew, firefox/webpack/userJourneyAssets, firefox/webpack/userJourneyAccountManagement, firefox/webpack/userJourneyTransactions

✅ No regressions detected

Dapp Page Load Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/pageLoadBenchmark

✅ No regressions detected

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: -304 Bytes (0%)
  • ui: 479.19 KiB (5.55%)
  • common: 3.93 KiB (0.03%)

@DDDDDanica DDDDDanica requested a review from davidmurdoch May 7, 2026 19:52
},
"@emotion/react>@emotion/cache": {
"globals": {
"document": true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@naugtur webpack's policy build has narrowed the document usages here down to a reasonable subset, usual just one or two properties on document. With webpack aiming to be released in about 1-2 weeks, do you think we should still bother with locking this down in the browserify build today?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants