From c951e253c6c025e8d104f30e37b0d5994bf19deb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 22 Feb 2017 12:53:29 -0800 Subject: [PATCH] Default to focused window whenever param is null/undefined --- lib/browser/api/menu.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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