fix: menu should allow focused BaseWindow where possible (#43404)

fix: menu should allow focused BaseWindow
This commit is contained in:
Shelley Vohr 2024-08-22 20:13:30 +02:00 committed by GitHub
parent 7391db93e2
commit 50ce448556
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 19 deletions

View file

@ -1,5 +1,5 @@
import * as roles from '@electron/internal/browser/api/menu-item-roles';
import { Menu, BrowserWindow, WebContents, KeyboardEvent } from 'electron/main';
import { Menu, BaseWindow, WebContents, KeyboardEvent } from 'electron/main';
let nextCommandId = 0;
@ -53,7 +53,7 @@ const MenuItem = function (this: any, options: any) {
});
const click = options.click;
this.click = (event: KeyboardEvent, focusedWindow: BrowserWindow, focusedWebContents: WebContents) => {
this.click = (event: KeyboardEvent, focusedWindow: BaseWindow, focusedWebContents: WebContents) => {
// Manually flip the checked flags when clicked.
if (!roles.shouldOverrideCheckStatus(this.role) &&
(this.type === 'checkbox' || this.type === 'radio')) {