diff --git a/lib/browser/chrome-devtools.js b/lib/browser/chrome-devtools.js index abcb1658446..2ca61992ca1 100644 --- a/lib/browser/chrome-devtools.js +++ b/lib/browser/chrome-devtools.js @@ -71,6 +71,9 @@ ipcMainUtils.handle('ELECTRON_INSPECTOR_CONTEXT_MENU', function (event, items, i const window = event.sender.getOwnerBrowserWindow() menu.once('menu-will-close', () => { + // menu-will-close is emitted before the click handler, but needs to be sent after. + // otherwise, DevToolsAPI.contextMenuCleared() would be called before + // DevToolsAPI.contextMenuItemSelected(id) and the menu will not work properly. setTimeout(() => { event._replyInternal('ELECTRON_INSPECTOR_CONTEXT_MENU_CLOSE') })