Repository navigation
Closed
Description
The docs for Menu.popup(window, options) https://electron.atom.io/docs/api/menu/#menupopupbrowserwindow-options generates this definition for PopupOptions:
interface PopupOptions {
/**
* Default is the current mouse cursor position.
*/
x?: number;
/**
* ( if x is used) Default is the current mouse cursor position.
*/
y: number;
/**
* Set to true to have this method return immediately called, false to return after
* the menu has been selected or closed. Defaults to false.
*/
async?: boolean;
/**
* The index of the menu item to be positioned under the mouse cursor at the
* specified coordinates. Default is -1.
*/
positioningItem?: number;
}The required y here doesn't reflect the correct state (x and y are undefined, or x and y are defined).
This breaks GitHub Desktop's usage, because we don't care about the location:
const window = BrowserWindow.fromWebContents(event.sender)
menu.popup(window, { async: true })This works around the issue, but might be able to be simplified down:
interface PopupOptionsLocation {
/**
* Default is the current mouse cursor position.
*/
x: number;
/**
* ( if x is used) Default is the current mouse cursor position.
*/
y: number;
/**
* Set to true to have this method return immediately called, false to return after
* the menu has been selected or closed. Defaults to false.
*/
async?: boolean;
/**
* The index of the menu item to be positioned under the mouse cursor at the
* specified coordinates. Default is -1.
*/
positioningItem?: number;
}
interface PopupOptionsNoLocation {
/**
* Set to true to have this method return immediately called, false to return after
* the menu has been selected or closed. Defaults to false.
*/
async?: boolean;
/**
* The index of the menu item to be positioned under the mouse cursor at the
* specified coordinates. Default is -1.
*/
positioningItem?: number;
}
type PopupOptions = PopupOptionsLocation | PopupOptionsNoLocation
Activity