From 2217f51cf8d7022cafe49301a523ea55cbddc5b4 Mon Sep 17 00:00:00 2001 From: Benjamin Christopher Simmonds <44439583+benibenj@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:01:41 +0100 Subject: [PATCH] Fix title bar focus command when hidden (#236635) fix #236597 --- src/vs/workbench/browser/parts/titlebar/titlebarPart.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 3facaf51e23..32dad57a218 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -54,6 +54,7 @@ import { IBaseActionViewItemOptions } from '../../../../base/browser/ui/actionba import { IHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegate.js'; import { CommandsRegistry } from '../../../../platform/commands/common/commands.js'; import { safeIntl } from '../../../../base/common/date.js'; +import { TitleBarVisibleContext } from '../../../common/contextkeys.js'; export interface ITitleVariable { readonly name: string; @@ -119,11 +120,12 @@ export class BrowserTitleService extends MultiWindowParts i title: localize2('focusTitleBar', 'Focus Title Bar'), category: Categories.View, f1: true, + precondition: TitleBarVisibleContext }); } run(): void { - that.getPartByDocument(getActiveDocument()).focus(); + that.getPartByDocument(getActiveDocument())?.focus(); } })); }