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

fix: emit context-menu event in Windows draggable regions

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-03-14 09:54:21 -05:00 committed by GitHub
parent a3af41674f
commit a1ec212049
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]>;