:art:
authorKevin Sawicki <kevinsawicki@gmail.com>
Wed, 13 Jul 2016 21:49:25 +0000 (14:49 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Wed, 13 Jul 2016 21:49:25 +0000 (14:49 -0700)
lib/browser/api/menu.js
lib/browser/api/web-contents.js

index 64397ce..a68383c 100644 (file)
@@ -118,7 +118,6 @@ Menu.prototype._init = function () {
     executeCommand: (event, commandId) => {
       const command = this.commandsMap[commandId]
       if (command == null) return
-
       command.click(event, BrowserWindow.getFocusedWindow(), webContents.getFocusedWebContents())
     },
     menuWillShow: () => {
index 8da8a2b..c172064 100644 (file)
@@ -251,12 +251,10 @@ module.exports = {
     let focused = null
     for (let contents of getAllWebContents()) {
       if (!contents.isFocused()) continue
-
+      if (focused == null) focused = contents
       // Return webview web contents which may be embedded inside another
       // web contents that is also reporting as focused
       if (contents.getType() === 'webview') return contents
-
-      if (focused == null) focused = contents
     }
     return focused
   }