Electron parent and child window conflict while using modal window


#1

I am new to Electron and have freshly started an Electron project in our company. Using Electron the way to create a modal window is to: set the parent for that new child browser window and by setting the modal type to true. This works well and fine.

My case is, we have so many modal windows that needs to be popped up, that is being achieved by making a synchronous call from the renderer to the main, where main.js opens up the new modal window.

I am passing a variable called parent from the renderer(: remote.getCurrentWindow()) and in my main on ipcMain i am fetching that parent variable and setting it as the parent of the child window and by setting the modal to true,

This doesn’t seem to work as the more and more windows are getting called from renderer, the browser window even though setting the parent attribute as obtained from the renderer doesn’t act as a modal window, i.e., it gets closed when the focus is moved away.

In this case how do i come to know that which is the parent window of this new browser window which is about to open up?

How do i overcome this??