Skip to content

Commit 3aefa48

Browse files
RubenSmnPalmerAL
andauthored
Fix/tab item alignment (#2222)
* fix: close and secure icon not vertically centered * fix: tab item permission icon not vertically centered * fix: reader icon not centered * fix: order of items in tab * fix: reader button not aligned with close button * fix: tab items aligned with space between * chore: update hover effect close button * fix: navigation buttons too much spacing * fix: tab title spacing * fix: title not aligned left * fix: permission icons smushed * fix: no spacing close and secure icon * fix: navigation buttons no animation * improve forward button spacing * fix: extra spacing when no icons in icon-area * tab item spacing fix * Update css/tabBar.css * fix: hover tab on touch screen Co-authored-by: PalmerAL <PalmerAL@users.noreply.github.com> --------- Co-authored-by: PalmerAL <PalmerAL@users.noreply.github.com>
1 parent 4afa862 commit 3aefa48

File tree

2 files changed

+60
-42
lines changed

2 files changed

+60
-42
lines changed

css/tabBar.css

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,35 @@
3636
/* navbar buttons */
3737

3838
#toolbar-navigation-buttons {
39-
width: 2.375rem;
39+
width: 2rem;
4040
transition: 0.1s width;
4141
white-space: nowrap;
4242
overflow: hidden;
4343
}
4444

4545
#toolbar-navigation-buttons.can-go-forward:hover {
46-
width: 4.25rem;
46+
width: 4rem;
4747
}
4848

4949
body.is-edit-mode #toolbar-navigation-buttons {
5050
display: none;
5151
}
5252

53-
#back-button, #forward-button {
53+
#back-button,
54+
#forward-button {
5455
opacity: 1;
5556
transition: none;
56-
padding: 0 0.6rem;
57+
padding: 0;
58+
width: 2rem;
5759
}
58-
#back-button {
59-
padding-left: 0.4rem;
60+
#back-button:disabled,
61+
#forward-button:disabled {
62+
opacity: 0.2;
6063
}
64+
65+
/* Remove default space from being inline-block */
6166
#forward-button {
62-
margin-left: -0.75em;
63-
}
64-
#back-button:disabled, #forward-button:disabled {
65-
opacity: 0.2;
67+
margin-left: -0.25rem;
6668
}
6769

6870
#menu-button {
@@ -107,7 +109,11 @@ body.linux #menu-button {
107109
overflow: hidden;
108110
word-break: break-all;
109111
position: relative;
110-
padding: 0 0.8em;
112+
display: flex;
113+
align-items: stretch;
114+
gap: 0.5rem;
115+
padding-left: 0.5rem;
116+
padding-right: 0.5rem;
111117
}
112118
.tab-item.gu-mirror {
113119
top: var(--control-space-top) !important;
@@ -153,14 +159,25 @@ body.linux #menu-button {
153159
/* icons */
154160

155161
.tab-item .tab-icon-area {
156-
float: right;
157-
margin-right: -0.7em;
162+
display: flex;
163+
align-items: center;
164+
gap: 0.5rem;
165+
order: 1;
166+
}
167+
body:not(.touch)
168+
.tab-item:not(:hover)
169+
.tab-icon-area:has(.tab-close-button:only-child) {
170+
margin-left: -0.5rem;
158171
}
172+
159173
.tab-item .tab-icon {
160174
position: relative;
161175
font-size: 0.875em;
162-
padding: 0.7125em 0.5em;
163-
box-sizing: content-box;
176+
box-sizing: border-box;
177+
display: flex;
178+
justify-content: center;
179+
align-items: center;
180+
height: 100%;
164181
}
165182
.tab-item .tab-icon:not(.permission-request-icon):hover:after {
166183
content: "";
@@ -169,8 +186,9 @@ body.linux #menu-button {
169186
border-radius: 50%;
170187
background: rgba(0, 0, 0, 0.075);
171188
position: absolute;
172-
top: -3px;
173-
left: -3px;
189+
top: 50%;
190+
left: 50%;
191+
transform: translate(-50%, -50%);
174192
z-index: -1;
175193
}
176194
.dark-theme .tab-item .tab-icon:hover:after {
@@ -209,6 +227,9 @@ body.linux #menu-button {
209227
}
210228
.tab-item .title {
211229
font-size: 15px;
230+
padding-left: 0.25rem;
231+
padding-right: 0.25rem;
232+
margin-right: auto;
212233
}
213234

214235
/* buttons */
@@ -244,7 +265,7 @@ body.windows.dark-theme .navbar-action-button:not(:disabled):hover {
244265
/* audio button */
245266
.tab-item .tab-audio-button {
246267
vertical-align: text-bottom;
247-
padding: 0 0.5em 0 0;
268+
padding: 0;
248269
font-size: 1.1em !important;
249270
}
250271

@@ -253,29 +274,28 @@ body.windows.dark-theme .navbar-action-button:not(:disabled):hover {
253274
.tab-item .reader-button {
254275
display: none;
255276
vertical-align: text-bottom;
256-
padding: 0 0.5em 0 0;
257277
font-size: 1.1em !important;
278+
order: -1;
258279
}
259280
.tab-item.active .reader-button.can-reader {
260-
display: inline-block;
281+
display: inline-flex;
261282
}
262283
.tab-item.active .reader-button.is-reader {
263-
display: inline-block;
284+
display: inline-flex;
264285
}
265286

266287
/* permission request buttons */
267288

268289
.tab-item .tab-icon.permission-request-icon {
269290
border: 1px rgba(0, 0, 0, 0.3) solid;
270-
padding: 0.15em 0.17em;
271-
margin-right: 0.66em;
272-
margin-top: -0.2em;
273-
margin-left: -0.3em;
274-
border-radius: 0.75em;
291+
border-radius: 0.75rem;
292+
height: 70%;
293+
margin: auto 0;
294+
order: -1;
295+
padding-inline: 0.25rem;
275296
}
276297
.tab-item .tab-icon.permission-request-icon .i {
277298
vertical-align: middle;
278-
margin-top: -3px;
279299
display: inline-block;
280300
}
281301
.dark-theme .tab-item .tab-icon.permission-request-icon {
@@ -305,12 +325,10 @@ body.windows.dark-theme .navbar-action-button:not(:disabled):hover {
305325
/* in Carbon, close icon is a bit smaller than other icons, enlarge it in order to match with other icons */
306326
.tab-item .tab-close-button {
307327
font-size: 1.25em;
308-
padding: 0.3em 0.45em;
309-
margin-top: 0.15em;
328+
box-sizing: border-box;
329+
order: 1;
310330
}
311331
.tab-item .tab-close-button:hover:after {
312-
top: 4px !important;
313-
left: 7px !important;
314332
font-size: 0.9em;
315333
}
316334

@@ -338,7 +356,7 @@ body.is-focus-mode .navbar-action-button:not(#menu-button) {
338356
position: absolute;
339357
top: 0;
340358
left: 0;
341-
margin: 0 0.8em;
359+
/* margin: 0 0.8em; */
342360
overflow: hidden;
343361
}
344362

js/navbar/tabBar.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ const tabBar = {
6565
iconArea.appendChild(pbIcon)
6666
}
6767

68-
var secIcon = document.createElement('i')
69-
secIcon.className = 'icon-tab-not-secure tab-icon tab-info-icon i carbon:unlocked'
70-
secIcon.title = l('connectionNotSecure')
71-
iconArea.appendChild(secIcon)
72-
7368
var closeTabButton = document.createElement('button')
7469
closeTabButton.className = 'tab-icon tab-close-button i carbon:close'
7570

@@ -166,11 +161,16 @@ const tabBar = {
166161
tabEl.insertBefore(button, tabEl.children[0])
167162
})
168163

169-
var secIcon = tabEl.getElementsByClassName('icon-tab-not-secure')[0]
170-
if (tabData.secure === false) {
171-
secIcon.hidden = false
172-
} else {
173-
secIcon.hidden = true
164+
var iconArea = tabEl.getElementsByClassName('tab-icon-area')[0]
165+
166+
var insecureIcon = tabEl.getElementsByClassName('icon-tab-not-secure')[0]
167+
if (tabData.secure === true && insecureIcon) {
168+
insecureIcon.remove()
169+
} else if (tabData.secure === false && !insecureIcon) {
170+
var insecureIcon = document.createElement('i')
171+
insecureIcon.className = 'icon-tab-not-secure tab-icon tab-info-icon i carbon:unlocked'
172+
insecureIcon.title = l('connectionNotSecure')
173+
iconArea.appendChild(insecureIcon)
174174
}
175175
},
176176
updateAll: function () {

0 commit comments

Comments
 (0)