How to lose focus from the menu to the previous focused window


Hi I have an electron application and i have incorporated a menu at the top right corner using the menu module of electron. As soon as I click on the menu and the submenu, the focus is lost from the current focused window and as a result BrowserWindow.getFocusedWindow().getWebContents().copy() does not work. Can anyone help me with this?