Skip to content

Commit 41c0295

Browse files
joaomorenoroblourens
authored andcommitted
Better action hover feedback (microsoft#120247)
* wip: better action hover feedback * address feedback from microsoft#120247 * Prevent settings editor gear button hover from running into the TOC * final fixes Co-authored-by: Rob Lourens <[email protected]>
1 parent 07c5af4 commit 41c0295

File tree

24 files changed

+130
-167
lines changed

24 files changed

+130
-167
lines changed

src/vs/base/browser/ui/actionbar/actionbar.css

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
.monaco-action-bar {
77
text-align: right;
88
white-space: nowrap;
9+
height: 100%;
910
}
1011

1112
.monaco-action-bar .actions-container {
1213
display: flex;
1314
margin: 0 auto;
1415
padding: 0;
16+
height: 100%;
1517
width: 100%;
1618
justify-content: flex-end;
1719
}
@@ -21,18 +23,21 @@
2123
}
2224

2325
.monaco-action-bar .action-item {
26+
display: flex;
27+
align-items: center;
28+
justify-content: center;
2429
cursor: pointer;
25-
display: inline-block;
26-
transition: transform 50ms ease;
2730
position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
31+
min-width: 24px;
2832
}
2933

30-
.monaco-action-bar .action-item.disabled {
31-
cursor: default;
34+
.monaco-action-bar:not(.vertical) .action-item {
35+
margin-right: 4px;
3236
}
3337

34-
.monaco-action-bar.animated .action-item.active {
35-
transform: scale(1.272019649, 1.272019649); /* 1.272019649 = √φ */
38+
.monaco-action-bar .action-item.disabled {
39+
cursor: default;
40+
min-width: 0;
3641
}
3742

3843
.monaco-action-bar .action-item .icon,
@@ -47,7 +52,8 @@
4752

4853
.monaco-action-bar .action-label {
4954
font-size: 11px;
50-
margin-right: 4px;
55+
padding: 3px;
56+
border-radius: 5px;
5157
}
5258

5359
.monaco-action-bar .action-item.disabled .action-label,
@@ -74,10 +80,6 @@
7480
margin-right: .8em;
7581
}
7682

77-
.monaco-action-bar.animated.vertical .action-item.active {
78-
transform: translate(5px, 0);
79-
}
80-
8183
.secondary-actions .monaco-action-bar .action-label {
8284
margin-left: 6px;
8385
}

src/vs/base/browser/ui/dropdown/dropdown.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
.monaco-dropdown > .dropdown-label {
1212
cursor: pointer;
1313
height: 100%;
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
1417
}
1518

1619
.monaco-dropdown > .dropdown-label > .action-label.disabled {

src/vs/base/browser/ui/splitview/paneview.css

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
margin-left: auto;
5353
}
5454

55+
.monaco-pane-view .pane > .pane-header > .actions .action-label {
56+
padding: 2px;
57+
}
58+
5559
/* TODO: actions should be part of the pane, but they aren't yet */
5660
.monaco-pane-view .pane:hover > .pane-header.expanded > .actions,
5761
.monaco-pane-view .pane:focus-within > .pane-header.expanded > .actions,
@@ -60,22 +64,6 @@
6064
display: initial;
6165
}
6266

63-
/* TODO: actions should be part of the pane, but they aren't yet */
64-
.monaco-pane-view .pane > .pane-header > .actions .action-label.icon,
65-
.monaco-pane-view .pane > .pane-header > .actions .action-label.codicon {
66-
width: 28px;
67-
height: 22px;
68-
background-size: 16px;
69-
background-position: center center;
70-
background-repeat: no-repeat;
71-
margin-right: 0;
72-
display: flex;
73-
align-items: center;
74-
justify-content: center;
75-
color: inherit;
76-
outline-offset: -2px;
77-
}
78-
7967
.monaco-pane-view .pane > .pane-header .monaco-action-bar .action-item.select-container {
8068
cursor: default;
8169
}

src/vs/base/browser/ui/toolbar/toolbar.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
.monaco-toolbar {
7+
height: 100%;
8+
}
9+
610
.monaco-toolbar .toolbar-toggle-more {
711
display: inline-block;
812
padding: 0;

src/vs/editor/contrib/peekView/media/peekViewWidget.css

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,6 @@
5555
height: 100%;
5656
}
5757

58-
.monaco-editor .peekview-widget .head .peekview-actions > .monaco-action-bar .action-item {
59-
margin-left: 4px;
60-
}
61-
62-
.monaco-editor .peekview-widget .head .peekview-actions > .monaco-action-bar .action-label {
63-
width: 16px;
64-
height: 100%;
65-
margin: 0;
66-
line-height: inherit;
67-
background-repeat: no-repeat;
68-
background-position: center center;
69-
}
70-
71-
.monaco-editor .peekview-widget .head .peekview-actions > .monaco-action-bar .action-label.codicon {
72-
margin: 0;
73-
}
74-
7558
.monaco-editor .peekview-widget > .body {
7659
border-top: 1px solid;
7760
position: relative;

src/vs/platform/actions/browser/menuEntryActionViewItem.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
.monaco-action-bar .action-item.menu-entry .action-label.icon {
7+
width: 16px;
8+
height: 16px;
9+
background-repeat: no-repeat;
10+
background-position: 50%;
11+
}
12+
613
.monaco-action-bar .action-item.menu-entry .action-label {
714
background-image: var(--menu-entry-icon-light);
815
}

src/vs/platform/theme/common/colorRegistry.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,12 @@ export const menuSelectionBackground = registerColor('menu.selectionBackground',
404404
export const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('menuSelectionBorder', "Border color of the selected menu item in menus."));
405405
export const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#BBBBBB', light: '#888888', hc: contrastBorder }, nls.localize('menuSeparatorBackground', "Color of a separator menu item in menus."));
406406

407+
/**
408+
* Toolbar colors
409+
*/
410+
export const toolbarHoverBackground = registerColor('toolbar.hoverBackground', { dark: '#5a5d5e50', light: '#b8b8b850', hc: null }, nls.localize('toolbarHoverBackground', "Toolbar background when hovering over actions using the mouse"));
411+
export const toolbarActiveBackground = registerColor('toolbar.activeBackground', { dark: lighten(toolbarHoverBackground, 0.1), light: darken(toolbarHoverBackground, 0.1), hc: null }, nls.localize('toolbarActiveBackground', "Toolbar background when holding the mouse over actions"));
412+
407413
/**
408414
* Snippet placeholder colors
409415
*/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { toolbarActiveBackground, toolbarHoverBackground } from 'vs/platform/theme/common/colorRegistry';
7+
import { IColorTheme, ICssStyleCollector, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
8+
9+
registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => {
10+
collector.addRule(`
11+
.monaco-action-bar:not(.vertical) .action-label:not(.disabled):hover {
12+
background-color: ${theme.getColor(toolbarHoverBackground)};
13+
}
14+
`);
15+
16+
collector.addRule(`
17+
.monaco-action-bar:not(.vertical) .action-item.active .action-label:not(.disabled),
18+
.monaco-action-bar:not(.vertical) .monaco-dropdown.active .action-label:not(.disabled) {
19+
background-color: ${theme.getColor(toolbarActiveBackground)};
20+
}
21+
`);
22+
});

src/vs/workbench/browser/media/part.css

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
.monaco-workbench .part {
7-
box-sizing: border-box;
7+
box-sizing: border-box;
88
overflow: hidden;
99
}
1010

@@ -29,7 +29,7 @@
2929
.monaco-workbench .part > .title {
3030
height: 35px;
3131
display: flex;
32-
box-sizing: border-box;
32+
box-sizing: border-box;
3333
overflow: hidden;
3434
}
3535

@@ -73,9 +73,6 @@
7373

7474
.monaco-workbench .part > .title > .title-actions .action-label {
7575
display: block;
76-
height: 35px;
77-
line-height: 35px;
78-
min-width: 28px;
7976
background-size: 16px;
8077
background-position: center center;
8178
background-repeat: no-repeat;
@@ -103,6 +100,10 @@
103100
}
104101

105102
.monaco-workbench .part > .content > .monaco-progress-container .progress-bit,
106-
.monaco-workbench .part.editor > .content .monaco-progress-container .progress-bit {
103+
.monaco-workbench
104+
.part.editor
105+
> .content
106+
.monaco-progress-container
107+
.progress-bit {
107108
height: 2px;
108109
}

src/vs/workbench/browser/parts/editor/media/editorgroupview.css

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,13 @@
7373

7474
.monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar {
7575
display: none;
76+
height: 35px;
7677
}
7778

7879
.monaco-workbench .part.editor > .content:not(.empty) .editor-group-container.empty > .editor-group-container-toolbar {
7980
display: block;
8081
}
8182

82-
.monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar .action-label {
83-
display: block;
84-
height: 35px;
85-
line-height: 35px;
86-
min-width: 28px;
87-
background-size: 16px;
88-
background-position: center center;
89-
background-repeat: no-repeat;
90-
}
91-
9283
/* Editor */
9384

9485
.monaco-workbench .part.editor > .content .editor-group-container.empty > .editor-container {

0 commit comments

Comments
 (0)