Skip to content

Commit 3dc8040

Browse files
authored
Fix notebook actionItem hovers (microsoft#205719)
fix notebook actionItem hovers
1 parent 7560c3d commit 3dc8040

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
1313
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1414
import { IThemeService } from 'vs/platform/theme/common/themeService';
1515
import { ThemeIcon } from 'vs/base/common/themables';
16+
import { ICustomHover, setupCustomHover } from 'vs/base/browser/ui/iconLabel/iconLabelHover';
17+
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
1618

1719
export class CodiconActionViewItem extends MenuEntryActionViewItem {
1820

@@ -38,12 +40,12 @@ export class ActionViewWithLabel extends MenuEntryActionViewItem {
3840
if (this._actionLabel) {
3941
this._actionLabel.classList.add('notebook-label');
4042
this._actionLabel.innerText = this._action.label;
41-
this._actionLabel.title = this._action.tooltip.length ? this._action.tooltip : this._action.label;
4243
}
4344
}
4445
}
4546
export class UnifiedSubmenuActionView extends SubmenuEntryActionViewItem {
4647
private _actionLabel?: HTMLAnchorElement;
48+
private _hover?: ICustomHover;
4749

4850
constructor(
4951
action: SubmenuItemAction,
@@ -63,6 +65,10 @@ export class UnifiedSubmenuActionView extends SubmenuEntryActionViewItem {
6365
container.classList.add('notebook-action-view-item');
6466
this._actionLabel = document.createElement('a');
6567
container.appendChild(this._actionLabel);
68+
69+
const hoverDelegate = this.options.hoverDelegate ?? getDefaultHoverDelegate('element');
70+
this._hover = this._register(setupCustomHover(hoverDelegate, this._actionLabel, ''));
71+
6672
this.updateLabel();
6773
}
6874

@@ -88,13 +94,13 @@ export class UnifiedSubmenuActionView extends SubmenuEntryActionViewItem {
8894
if (this.renderLabel) {
8995
this._actionLabel.classList.add('notebook-label');
9096
this._actionLabel.innerText = this._action.label;
91-
this._actionLabel.title = primaryAction.tooltip.length ? primaryAction.tooltip : primaryAction.label;
97+
this._hover?.update(primaryAction.tooltip.length ? primaryAction.tooltip : primaryAction.label);
9298
}
9399
} else {
94100
if (this.renderLabel) {
95101
this._actionLabel.classList.add('notebook-label');
96102
this._actionLabel.innerText = this._action.label;
97-
this._actionLabel.title = this._action.tooltip.length ? this._action.tooltip : this._action.label;
103+
this._hover?.update(this._action.tooltip.length ? this._action.tooltip : this._action.label);
98104
}
99105
}
100106
}

0 commit comments

Comments
 (0)