Context menu On some platforms, the draggable area will be treated as
a non-client frame, so when you right click on it a system menu will
pop up. To make the context menu behave correctly on all platforms you
should never use a custom context menu on draggable areas.
Taken from https://github.com/electron/electron/blob/master/docs/api/frameless-window.md
Is there a way to work around this. I need to have an image dragable and able to handle both click and right click events. (Much like Facebook messenger on mobile devices).
It setting an element as dragable (-webkit-app-region: drag;) and using context menu event works as expected in mac but when using the build on windows it doesn’t work.
2
Answers
There is no way to have
-webkit-app-region: drag;
and a context menu on Windows. That’s because Windows displays its own context menu for these UI items.Another option is electron-drag which can simulate
webkit-app-region
.do some as below, use pointerevent to capture mouse outside of BrowserWindow