I have a #topleft
red title bar containing multiple "tab" buttons that should fill all the available space except a #topright
blue block.
It is possible to move the main Electron window by click-and-dragging on #topleft
's red background, thanks to -webkit-app-region: drag;
. This works.
Problems:
- clicks on
#topright
are ignored:alert()
is not triggered (same problem for child elements of this block) #topright span:hover { background-color: black; }
is ignored#topright { -webkit-app-region: no-drag; }
is ignored: we can still move the window by click-and-dragging on#topright
whereas it should not
However if we run the same HTML code in a browser, all is working correctly.
How to solve this in Electron?
for (var i = 0; i < 50; i++)
document.getElementById("topleft").innerHTML += "<button>xyz" + i + "</button>";
* { margin: 0; }
#topright { float: right; width: 100px; background-color: blue; -webkit-app-region: no-drag; }
#topright:hover { background-color: black; }
#topleft { background-color: red; -webkit-app-region: drag; padding: 10px; }
<div id="topright" onclick="alert();">Click here!</div>
<div id="topleft"></div>
Note:
I've already seen I've already seen Frameless window with controls in electron (Windows) but it doesn't help here.
Linked issue