Skip to content

Commit c306c13

Browse files
fix: global scroll bar styles (#38874)
## **Description** This PR centralizes scrollbar styling across the MetaMask extension to ensure a consistent user experience. Previously, scrollbar styles were duplicated across multiple component files, leading to inconsistency between browser-native scrollbars and our custom styles. **Changes:** - **Added global scrollbar styles** to `ui/css/base-styles.scss` that apply to all scrollable elements - Firefox: `scrollbar-width: thin` with muted color scheme - Webkit browsers (Chrome, Brave, Safari): 8px width with rounded corners and muted background - **Removed duplicate scrollbar declarations** from 5 component files: - `modal-content.scss` - `multichain/pages/page/components/content/index.scss` - `form-combo-field/index.scss` (partial - kept hidden scrollbar override) - `bridge/index.scss` (partial - kept `scrollbar-width: none` override) - `settings/index.scss` - **Retained component-specific overrides** where intentionally different behavior is needed (e.g., hidden scrollbars in bridge page) **Result:** Net reduction of 32 lines of code while achieving consistent 8px scrollbar styling across the extension. Related: [Slack Discussion](https://consensys.slack.com/archives/C0354T27M5M/p1765815374100129?thread_ts=1765815374.100129&cid=C0354T27M5M) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38874?quickstart=1) ## **Changelog** CHANGELOG entry: Standardized scrollbar styling across the extension for visual consistency ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MDP-644 ## **Manual testing steps** 1. Build and run the extension locally 2. Navigate through different parts of the extension that have scrollable content: - Open Settings and scroll through different tabs - Open a modal with scrollable content (e.g., network list, token list) - View the Bridge page - Check multichain pages with scrollable lists 3. Verify that scrollbars appear consistently with 8px width and muted color 4. Test in both Chrome and Firefox browsers 5. Verify that intentionally hidden scrollbars (e.g., Bridge page) remain hidden ## **Screenshots/Recordings** ### **Before** Inconsistent scrollbar widths and colors across different components, with duplicate CSS in multiple files. https://github.com/user-attachments/assets/284e9e5d-1908-42d3-8d21-c714dd0c0faf ### **After** Consistent 8px scrollbar styling across all scrollable areas, that adheres to design system colors (Brave browser) https://github.com/user-attachments/assets/cee0b8a2-368d-4718-ac37-7519efc464ef Scroll bar in expanded and side panel views https://github.com/user-attachments/assets/45fa448f-6daf-45fb-9a14-c91aa368dbfa Firefox https://github.com/user-attachments/assets/b4a1c24d-2aa5-48d0-b3aa-bb14554ce686 ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/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 (N/A for styling changes) - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable (N/A for styling changes) - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds global cross‑browser scrollbar styles and removes component‑level scrollbar rules for consistency. > > - **CSS/Base**: > - Add global scrollbar styles in `ui/css/base-styles.scss` (Firefox thin, WebKit 8px with rounded thumb, transparent track). > - **Cleanup**: > - Remove duplicate/override scrollbar rules from multiple components: `modal-content`, multichain (`pages/page/content`, `import-tokens-modal`), `form-combo-field`, `popover`, `newui-sections` main container, Tailwind utility, `bridge`, `connect-hardware` (unsupported-browser), `settings`, and `swaps`. > - **Behavior**: > - Keep existing overflow behavior; rely on global styles for appearance. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 724820c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 8f9b5ac commit c306c13

File tree

12 files changed

+23
-106
lines changed

12 files changed

+23
-106
lines changed

ui/components/component-library/modal-content/modal-content.scss

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@
1111
padding: 8px;
1212
}
1313

14-
// Scroll bar styles
15-
// Firefox
16-
scrollbar-width: thin;
17-
scrollbar-color: var(--color-icon-muted) transparent;
18-
19-
// Webkit: Chrome, Brave
20-
::-webkit-scrollbar {
21-
width: 8px;
22-
}
23-
24-
::-webkit-scrollbar-thumb {
25-
-webkit-border-radius: 8px;
26-
border-radius: 8px;
27-
background: var(--color-icon-muted);
28-
}
29-
3014
&__dialog {
3115
--modal-content-size: var(--size, 360px);
3216

ui/components/multichain/import-tokens-modal/index.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
.import-tokens-modal {
44
$self: &;
55

6-
&__body::-webkit-scrollbar {
7-
display: none;
8-
}
9-
106
&__body {
117
overflow-y: auto;
128
}
@@ -33,8 +29,6 @@
3329
}
3430

3531
&__search-list {
36-
-ms-overflow-style: none;
37-
scrollbar-width: none;
3832
overflow-y: scroll;
3933
max-width: 100%;
4034
overflow: auto;
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
.multichain-page-content {
22
overflow: auto;
3-
// Scroll bar styles
4-
// Firefox
5-
scrollbar-width: thin;
6-
scrollbar-color: var(--color-icon-muted) transparent;
7-
8-
// Webkit: Chrome, Brave
9-
::-webkit-scrollbar {
10-
width: 8px;
11-
}
12-
13-
::-webkit-scrollbar-thumb {
14-
-webkit-border-radius: 8px;
15-
border-radius: 8px;
16-
background: var(--color-icon-muted);
17-
}
183
}

ui/components/ui/form-combo-field/index.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
.form-combo-field {
22
width: 100%;
33

4-
::-webkit-scrollbar-thumb {
5-
-webkit-border-radius: 8px;
6-
border-radius: 8px;
7-
background: var(--color-icon-muted);
8-
}
9-
10-
::-webkit-scrollbar {
11-
width: 0;
12-
}
13-
144
&__value > div {
155
outline: 0;
166
width: 100%;
@@ -28,10 +18,6 @@
2818
overflow-y: scroll;
2919
z-index: 1;
3020
background-color: var(--color-background-default);
31-
32-
&__scroll::-webkit-scrollbar {
33-
width: 8px;
34-
}
3521
}
3622

3723
&__option {

ui/components/ui/popover/index.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
.popover {
44
&-wrap {
5-
::-webkit-scrollbar {
6-
width: 6px;
7-
}
8-
9-
::-webkit-scrollbar-thumb {
10-
-webkit-border-radius: 10px;
11-
border-radius: 10px;
12-
background: var(--color-icon-muted);
13-
}
14-
155
display: flex;
166
flex-direction: column;
177
position: absolute;

ui/css/base-styles.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,26 @@ a:hover {
7575
* {
7676
font-family: design-system.$font-family;
7777
}
78+
79+
/** Global Scrollbar Styles **/
80+
81+
/* Firefox */
82+
* {
83+
scrollbar-width: thin;
84+
scrollbar-color: var(--color-icon-muted) transparent;
85+
}
86+
87+
/* Webkit: Chrome, Brave, Safari */
88+
::-webkit-scrollbar {
89+
width: 8px;
90+
}
91+
92+
::-webkit-scrollbar-thumb {
93+
-webkit-border-radius: 8px;
94+
border-radius: 8px;
95+
background: var(--color-icon-muted);
96+
}
97+
98+
::-webkit-scrollbar-track {
99+
background: transparent;
100+
}

ui/css/itcss/components/newui-sections.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
z-index: design-system.$main-container-z-index;
3838
}
3939

40-
.main-container::-webkit-scrollbar {
41-
display: none;
42-
}
43-
4440
.main-container-wrapper {
4541
display: flex;
4642
justify-content: center;

ui/css/tailwind.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
5-
@layer utilities {
6-
.no-scrollbar::-webkit-scrollbar {
7-
display: none;
8-
}
9-
}

ui/pages/bridge/index.scss

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,4 @@
1616
.bridge__container {
1717
height: 100%;
1818
overflow-y: scroll;
19-
// Scroll bar styles
20-
// Firefox
21-
scrollbar-width: none;
22-
scrollbar-color: var(--color-icon-muted) transparent;
23-
24-
// Webkit: Chrome, Brave
25-
::-webkit-scrollbar {
26-
width: 8px;
27-
}
28-
29-
::-webkit-scrollbar-thumb {
30-
-webkit-border-radius: 8px;
31-
border-radius: 8px;
32-
background: var(--color-icon-muted);
33-
}
3419
}

ui/pages/create-account/connect-hardware/index.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,6 @@
258258
&.unsupported-browser {
259259
height: 210px;
260260
overflow: auto;
261-
scrollbar-width: none;
262-
263-
&::-webkit-scrollbar {
264-
display: none;
265-
}
266261
}
267262

268263
&.account-list {

0 commit comments

Comments
 (0)