From b9402642a097b0ec9517876d56b46a5f9cb8bf20 Mon Sep 17 00:00:00 2001 From: eeakrnm Date: Mon, 4 May 2020 09:22:05 -0500 Subject: [PATCH] fix electron-context-menu bug Signed-off-by: Kenneth Marut Signed-off-by: Colin Grant --- .../electron-browser/menu/electron-context-menu-renderer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/electron-browser/menu/electron-context-menu-renderer.ts b/packages/core/src/electron-browser/menu/electron-context-menu-renderer.ts index 6a551c9d12a2d..b93ae2e67b887 100644 --- a/packages/core/src/electron-browser/menu/electron-context-menu-renderer.ts +++ b/packages/core/src/electron-browser/menu/electron-context-menu-renderer.ts @@ -44,7 +44,9 @@ export class ElectronContextMenuRenderer extends ContextMenuRenderer { protected doRender({ menuPath, anchor, args, onHide }: RenderContextMenuOptions): ElectronContextMenuAccess { const menu = this.menuFactory.createContextMenu(menuPath, args); - menu.popup({}); + const { x, y } = anchor instanceof MouseEvent ? { x: anchor.clientX, y: anchor.clientY } : anchor!; + // x and y values must be Ints or else there is a conversion error + menu.popup({ x: Math.round(x), y: Math.round(y) }); // native context menu stops the event loop, so there is no keyboard events this.context.resetAltPressed(); if (onHide) {