From 32dc72e557278626df78d5d345ffa2f992e3da97 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 12 Mar 2019 15:47:30 -0700 Subject: [PATCH] fixes #70022 --- src/vs/base/browser/ui/menu/menubar.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vs/base/browser/ui/menu/menubar.ts b/src/vs/base/browser/ui/menu/menubar.ts index a4283053ab0bc..cfb2fa8bf42b2 100644 --- a/src/vs/base/browser/ui/menu/menubar.ts +++ b/src/vs/base/browser/ui/menu/menubar.ts @@ -151,7 +151,12 @@ export class MenuBar extends Disposable { this._register(DOM.addDisposableListener(this.container, DOM.EventType.FOCUS_OUT, (e) => { let event = e as FocusEvent; - if (!event.relatedTarget || !this.container.contains(event.relatedTarget as HTMLElement)) { + // We are losing focus and there is no related target, e.g. webview case + if (!event.relatedTarget) { + this.setUnfocusedState(); + } + // We are losing focus and there is a target, reset focusToReturn value as not to redirect + else if (event.relatedTarget && !this.container.contains(event.relatedTarget as HTMLElement)) { this.focusToReturn = undefined; this.setUnfocusedState(); }