Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 669b394

Browse files
authored
πŸ’„ Clean up vertical tabs for the pulse theme (#201)
* ✨ Allow for resizing vertical tabs * πŸ’„ Specify a min-width for the tab container * πŸ’„ Allow resizing when collapse is enabled * πŸ› Fix tab squishing when reverting vertical tabs * πŸ’„ Correct color for vertical tab splitter Note: Only applies to pulse theme * πŸ’„ Remove extra left spacing in vertical tabs * πŸ’„ Curvy everything * πŸ’„ Fix vertical tabs overflow * πŸ› Fix resize re-ordering * πŸ’¬ Early access β†’ In dev
1 parent 57abbb6 commit 669b394

File tree

4 files changed

+62
-23
lines changed

4 files changed

+62
-23
lines changed

β€Žsrc/browser/base/content/browser-sidebar-js.patchβ€Ž

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,17 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..fa3cd3184cce8759c834fa0fadc645af
258258
}
259259
}
260260
},
261-
@@ -485,6 +628,9 @@ var SidebarUI = {
261+
@@ -286,6 +413,9 @@ var SidebarUI = {
262+
// First reset all ordinals to match DOM ordering.
263+
let browser = document.getElementById("browser");
264+
[...browser.children].forEach((node, i) => {
265+
+ // Do not change ordinal on vertical tabs
266+
+ if (node.id == 'TabsToolbar' || node.id == 'verticaltabs-splitter') return
267+
+
268+
node.style.MozBoxOrdinalGroup = i + 1;
269+
});
270+
271+
@@ -485,6 +615,9 @@ var SidebarUI = {
262272
},
263273

264274
_loadSidebarExtension(commandID) {
@@ -268,15 +278,15 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..fa3cd3184cce8759c834fa0fadc645af
268278
let sidebar = this.sidebars.get(commandID);
269279
let { extensionId } = sidebar;
270280
if (extensionId) {
271-
@@ -523,6 +669,7 @@ var SidebarUI = {
281+
@@ -523,6 +656,7 @@ var SidebarUI = {
272282
}
273283

274284
this._fireFocusedEvent();
275285
+ this.loadedSidebars.push(commandID);
276286
return true;
277287
});
278288
},
279-
@@ -546,10 +693,28 @@ var SidebarUI = {
289+
@@ -546,10 +680,28 @@ var SidebarUI = {
280290
}
281291
return this._show(commandID).then(() => {
282292
this._loadSidebarExtension(commandID);
@@ -305,7 +315,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..fa3cd3184cce8759c834fa0fadc645af
305315
/**
306316
* Implementation for show. Also used internally for sidebars that are shown
307317
* when a window is opened and we don't want to ping telemetry.
308-
@@ -559,6 +724,29 @@ var SidebarUI = {
318+
@@ -559,6 +711,29 @@ var SidebarUI = {
309319
*/
310320
_show(commandID) {
311321
return new Promise(resolve => {
@@ -335,7 +345,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..fa3cd3184cce8759c834fa0fadc645af
335345
this.selectMenuItem(commandID);
336346

337347
this._box.hidden = this._splitter.hidden = false;
338-
@@ -570,13 +758,21 @@ var SidebarUI = {
348+
@@ -570,13 +745,21 @@ var SidebarUI = {
339349
this._box.setAttribute("sidebarcommand", commandID);
340350
this.lastOpenedId = commandID;
341351

@@ -359,7 +369,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..fa3cd3184cce8759c834fa0fadc645af
359369
this.browser.addEventListener(
360370
"load",
361371
event => {
362-
@@ -615,22 +811,46 @@ var SidebarUI = {
372+
@@ -615,22 +798,46 @@ var SidebarUI = {
363373

364374
this.selectMenuItem("");
365375

@@ -413,7 +423,7 @@ index c5ac301416d2d820ba95e21c0ce1fe305e63b554..fa3cd3184cce8759c834fa0fadc645af
413423
},
414424

415425
/**
416-
@@ -638,25 +858,121 @@ var SidebarUI = {
426+
@@ -638,25 +845,121 @@ var SidebarUI = {
417427
* none if the argument is an empty string.
418428
*/
419429
selectMenuItem(commandID) {

β€Žsrc/browser/locales/en-US/browser/preferences/preferences-ftl.patchβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
2-
index f24485700321defc69cd57099ede164701b9b3ec..c62c09a76a96a8fd443537146edf4461839135f4 100644
2+
index f24485700321defc69cd57099ede164701b9b3ec..8061f090bf6d2fb29c4824d5d1a812688abfafb4 100644
33
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
44
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
55
@@ -1432,3 +1432,18 @@ httpsonly-radio-disabled =
@@ -16,7 +16,7 @@ index f24485700321defc69cd57099ede164701b9b3ec..c62c09a76a96a8fd443537146edf4461
1616
+preferences-sidebar-active-tabs-description = When enabled, sidebar tabs will remain active even when closed. When disabled, sidebar tabs will be closed when you click on another tab.
1717
+
1818
+preferences-vertical-tabs-enabled =
19-
+ .label = Use vertical tabs (Early Access)
19+
+ .label = Use vertical tabs (In dev)
2020
+preferences-vertical-tabs-collapse =
2121
+ .label = Collapse tabs
2222
+

β€Žsrc/browser/themes/pulse/addons/shared.cssβ€Ž

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,20 @@ tab.tabbrowser-tab:nth-child(1) {
108108
margin: 8px;
109109
}
110110

111+
#verticaltabs-splitter {
112+
background-color: var(--tab-selected-bgcolor, var(--toolbar-bgcolor));
113+
background-image: var(--tab-selected-bgimage, var(--toolbar-bgimage));
114+
-moz-default-appearance: auto !important;
115+
-moz-font-smoothing-background-color: auto !important;
116+
width: 4px;
117+
}
118+
111119
/* ========================================================================== */
112-
/* Sidebar tabs */
120+
/* Sidebar tabs & vertical tabs */
113121
.sidebar-item-background[checked='true']::before,
114-
.sidebar-item-background[checked='true']::after {
122+
.sidebar-item-background[checked='true']::after,
123+
#browser .tab-background[selected='true']::before,
124+
#browser .tab-background[selected='true']::after {
115125
content: '';
116126
position: absolute;
117127
right: 0;
@@ -128,19 +138,23 @@ tab.tabbrowser-tab:nth-child(1) {
128138
z-index: 10;
129139
}
130140

131-
.sidebar-item-background[checked='true']::before {
141+
.sidebar-item-background[checked='true']::before,
142+
#browser .tab-background[selected='true']::before {
132143
background-image: url('chrome://global/skin/icons/tab-rising-edge.svg');
133144
top: var(--tab-rounding-size-neg);
145+
left: unset; /* This is for vertical tabs */
134146
}
135147

136-
.sidebar-item-background[checked='true']::after {
148+
.sidebar-item-background[checked='true']::after,
149+
#browser .tab-background[selected='true']::after {
137150
background-image: url('chrome://global/skin/icons/tab-falling-edge.svg');
138151
bottom: var(--tab-rounding-size-neg);
139152
transform: rotate(180deg);
140153
}
141154

142155
/* Show the curve next to the sidebar panel */
143-
#sidebar-box[checked] ~ #appcontent::before {
156+
#sidebar-box[checked] ~ #appcontent::before,
157+
#browser #TabsToolbar ~ #appcontent::before {
144158
content: '';
145159

146160
background-image: url('chrome://global/skin/icons/tab-rising-edge.svg');
@@ -158,12 +172,14 @@ tab.tabbrowser-tab:nth-child(1) {
158172
transform: rotate(180deg);
159173
}
160174

161-
#appcontent {
175+
#appcontent,
176+
#browser #TabsToolbar {
162177
position: relative;
163178
}
164179

165180
/* Curve up at the top of the tabs */
166-
#sidebar-icons[checked]::before {
181+
#sidebar-icons[checked]::before,
182+
#browser #TabsToolbar::before {
167183
content: '';
168184
background-image: url('chrome://global/skin/icons/tab-rising-edge.svg');
169185
background-size: cover;
@@ -255,7 +271,14 @@ tab[pending],
255271
}
256272

257273
/* Hide the firefox view button */
258-
:root:not([privatebrowsingmode="temporary"]) :is(toolbarbutton, toolbarpaletteitem) + #tabbrowser-tabs, :root[privatebrowsingmode="temporary"] :is(toolbarbutton:not(#firefox-view-button), toolbarpaletteitem:not(#wrapper-firefox-view-button)) + #tabbrowser-tabs {
259-
border-inline-start: none;
274+
:root:not([privatebrowsingmode='temporary'])
275+
:is(toolbarbutton, toolbarpaletteitem)
276+
+ #tabbrowser-tabs,
277+
:root[privatebrowsingmode='temporary']
278+
:is(
279+
toolbarbutton:not(#firefox-view-button),
280+
toolbarpaletteitem:not(#wrapper-firefox-view-button)
281+
)
282+
+ #tabbrowser-tabs {
283+
border-inline-start: none;
260284
}
261-

β€Žsrc/browser/themes/pulse/vertical_tabs.cssβ€Ž

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
:root {
77
--vertical-tabs-max-width: 350px;
8+
--vertical-tabs-collapse-width: calc(
9+
16px + 2 * var(--inline-tab-padding) + 2 * var(--tab-block-margin)
10+
);
811
}
912

1013
#browser #TabsToolbar .titlebar-spacer,
@@ -20,17 +23,19 @@
2023
#browser #TabsToolbar {
2124
background-color: -moz-Dialog;
2225
max-width: var(--vertical-tabs-max-width);
26+
min-width: var(--vertical-tabs-collapse-width);
2327
-moz-box-ordinal-group: 0;
28+
overflow-x: hidden;
29+
30+
transition: min-width 150ms ease-in-out, max-width 150ms ease-in-out;
2431
}
2532

2633
#browser #TabsToolbar:not([collapse='true']) {
2734
min-width: 76px;
2835
}
2936

3037
#browser #TabsToolbar[collapse='true'] {
31-
max-width: calc(
32-
16px + 2 * var(--inline-tab-padding) + 2 * var(--tab-block-margin)
33-
);
38+
max-width: var(--vertical-tabs-collapse-width);
3439
}
3540

3641
/** On collapse hover of tabs or splitter, the max width should increase again */
@@ -106,7 +111,8 @@
106111

107112
#browser #tabbrowser-tabs {
108113
border-inline-start: none;
109-
margin-inline-start: none;
114+
margin-inline-start: 0;
115+
padding-inline-start: 0;
110116
}
111117

112118
#browser #TabsToolbar[collapse='true'] .tabbrowser-tab {

0 commit comments

Comments
Β (0)