In Electron, I'm trying to create a custom menu and loading it into the main window, like so:
window = new BrowserWindow({
frame: false
})
window.loadURL(`file://${__dirname}/menubar.html`)
Then, I load external content into a BrowserView()
, like so:
view = new BrowserView()
view.setBounds({
x: 0,
y: 32,
width: window.getContentBounds()['width'],
height: window.getContentBounds()['height'] - 32
})
view.webContents.loadURL(`[URL]`)
window.setBrowserView(view)
Now, the problem is that while I can see the menu bar, when I click on anything to open that menu it doesn't show because it's being covered by the BrowserView(). If I comment out/remove the window.setBrowserView(view)
line, or even change the x
bounds of the view (to something lower in the window), then I see the menu item just fine.
Is there a way to make the main window content overlap/overlay the browserview content?