diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index 28f51ca6be67..9615962ac66b 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -152,7 +152,7 @@ Menu.prototype.popup = function (window, x, y, positioningItem) { positioningItem = y y = x x = window - window = BrowserWindow.getFocusedWindow() + window = null } // menu.popup(window, {}) @@ -164,6 +164,9 @@ Menu.prototype.popup = function (window, x, y, positioningItem) { asyncPopup = options.async } + // Default to showing in focused window. + if (window == null) window = BrowserWindow.getFocusedWindow() + // Default to showing under mouse location. if (typeof x !== 'number') x = -1 if (typeof y !== 'number') y = -1