From 888ac65c72df227ed4d65d9177748d4082b13b0f Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Sun, 1 Aug 2021 18:58:28 -0700 Subject: [PATCH] fix: toggleDevTools menu role closes devtools window (#29922) --- lib/browser/api/menu-item-roles.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/browser/api/menu-item-roles.ts b/lib/browser/api/menu-item-roles.ts index e97a95c9a5ad..34ffe1b6e2ca 100644 --- a/lib/browser/api/menu-item-roles.ts +++ b/lib/browser/api/menu-item-roles.ts @@ -143,7 +143,10 @@ export const roleList: Record = { label: 'Toggle Developer Tools', accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I', nonNativeMacOSRole: true, - windowMethod: w => w.webContents.toggleDevTools() + webContentsMethod: wc => { + const bw = wc.getOwnerBrowserWindow(); + if (bw) bw.webContents.toggleDevTools(); + } }, togglefullscreen: { label: 'Toggle Full Screen',