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

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:
Robo 2025-03-28 09:21:17 +09:00 committed by GitHub
parent 929cba26c2
commit 60427961a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 5 deletions

View file

@ -2942,8 +2942,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]>;