Skip to content

Commit 047cf8c

Browse files
authored
Remove hover from elements using context view (microsoft#205586)
fix microsoft#205526
1 parent 232e9a2 commit 047cf8c

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/vs/base/browser/ui/actionbar/actionViewItems.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,17 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
226226
const title = this.getTooltip() ?? '';
227227
this.updateAriaLabel();
228228

229-
if (!this.customHover) {
230-
const hoverDelegate = this.options.hoverDelegate ?? getDefaultHoverDelegate('element');
231-
this.customHover = setupCustomHover(hoverDelegate, this.element, title);
232-
this._store.add(this.customHover);
229+
if (this.options.hoverDelegate?.showNativeHover) {
230+
/* While custom hover is not supported with context view */
231+
this.element.title = title;
233232
} else {
234-
this.customHover.update(title);
233+
if (!this.customHover) {
234+
const hoverDelegate = this.options.hoverDelegate ?? getDefaultHoverDelegate('element');
235+
this.customHover = setupCustomHover(hoverDelegate, this.element, title);
236+
this._store.add(this.customHover);
237+
} else {
238+
this.customHover.update(title);
239+
}
235240
}
236241
}
237242

src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { Categories } from 'vs/platform/action/common/actionCommonCategories';
3333
import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility';
3434
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
3535
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
36+
import { nativeHoverDelegate } from 'vs/platform/hover/browser/hover';
3637

3738
class LanguageStatusViewModel {
3839

@@ -327,7 +328,7 @@ class LanguageStatus {
327328
}
328329

329330
// -- pin
330-
const actionBar = new ActionBar(right, {});
331+
const actionBar = new ActionBar(right, { hoverDelegate: nativeHoverDelegate });
331332
store.add(actionBar);
332333
let action: Action;
333334
if (!isPinned) {

src/vs/workbench/electron-sandbox/window.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
7979
import { ThemeIcon } from 'vs/base/common/themables';
8080
import { getWorkbenchContribution } from 'vs/workbench/common/contributions';
8181
import { DynamicWorkbenchSecurityConfiguration } from 'vs/workbench/common/configuration';
82+
import { nativeHoverDelegate } from 'vs/platform/hover/browser/hover';
8283

8384
export class NativeWindow extends BaseWindow {
8485

@@ -1163,7 +1164,7 @@ class ZoomStatusEntry extends Disposable {
11631164
this.zoomLevelLabel = zoomLevelLabel;
11641165
disposables.add(toDisposable(() => this.zoomLevelLabel = undefined));
11651166

1166-
const actionBarLeft = disposables.add(new ActionBar(left));
1167+
const actionBarLeft = disposables.add(new ActionBar(left, { hoverDelegate: nativeHoverDelegate }));
11671168
actionBarLeft.push(zoomOutAction, { icon: true, label: false, keybinding: this.keybindingService.lookupKeybinding(zoomOutAction.id)?.getLabel() });
11681169
actionBarLeft.push(this.zoomLevelLabel, { icon: false, label: true });
11691170
actionBarLeft.push(zoomInAction, { icon: true, label: false, keybinding: this.keybindingService.lookupKeybinding(zoomInAction.id)?.getLabel() });
@@ -1172,7 +1173,7 @@ class ZoomStatusEntry extends Disposable {
11721173
right.classList.add('zoom-status-right');
11731174
container.appendChild(right);
11741175

1175-
const actionBarRight = disposables.add(new ActionBar(right));
1176+
const actionBarRight = disposables.add(new ActionBar(right, { hoverDelegate: nativeHoverDelegate }));
11761177

11771178
actionBarRight.push(zoomResetAction, { icon: false, label: true });
11781179
actionBarRight.push(zoomSettingsAction, { icon: true, label: false, keybinding: this.keybindingService.lookupKeybinding(zoomSettingsAction.id)?.getLabel() });

0 commit comments

Comments
 (0)