fix: emit context-menu event in Windows draggable regions (#45851)

fix: emit context-menu event in Windows draggable regions
This commit is contained in:
Shelley Vohr 2025-03-14 10:29:29 +01:00 committed by GitHub
parent 785fe5f3b6
commit 7c0b7b417b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 5 deletions

View file

@ -2896,8 +2896,13 @@ describe('webContents module', () => {
expect(contextMenuEmitCount).to.equal(1);
});
ifit(process.platform !== 'win32')('emits when right-clicked in page in a draggable region', async () => {
it('emits when right-clicked in page in a draggable region', async () => {
const w = new BrowserWindow({ show: false });
if (process.platform === 'win32') {
w.on('system-context-menu', (event) => { event.preventDefault(); });
}
await w.loadFile(path.join(fixturesPath, 'pages', 'draggable-page.html'));
const promise = once(w.webContents, 'context-menu') as Promise<[any, Electron.ContextMenuParams]>;