From 8ec6125ec47f6f06b1797c2acbad5e55a5dbec05 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 16 Apr 2026 23:00:41 +0300 Subject: [PATCH] fix(launch_bar): some context menus intercepted by browser --- apps/client/src/widgets/launch_bar/GenericButtons.tsx | 3 +++ apps/client/src/widgets/launch_bar/HistoryNavigation.tsx | 2 ++ 2 files changed, 5 insertions(+) diff --git a/apps/client/src/widgets/launch_bar/GenericButtons.tsx b/apps/client/src/widgets/launch_bar/GenericButtons.tsx index ba29b303b5..6933233a66 100644 --- a/apps/client/src/widgets/launch_bar/GenericButtons.tsx +++ b/apps/client/src/widgets/launch_bar/GenericButtons.tsx @@ -32,6 +32,9 @@ export function CustomNoteLauncher(props: { onClick={launch} onAuxClick={launch} onContextMenu={async evt => { + // Must preventDefault synchronously — awaiting getTargetNoteId first would let the + // native browser context menu open before showLauncherContextMenu gets a chance to. + evt.preventDefault(); const targetNoteId = await getTargetNoteId(launcherNote); const hoistedNoteId = getHoistedNoteId?.(launcherNote) ?? null; const linkItems = targetNoteId ? link_context_menu.getItems(evt) : []; diff --git a/apps/client/src/widgets/launch_bar/HistoryNavigation.tsx b/apps/client/src/widgets/launch_bar/HistoryNavigation.tsx index 11ad476312..b35e38f337 100644 --- a/apps/client/src/widgets/launch_bar/HistoryNavigation.tsx +++ b/apps/client/src/widgets/launch_bar/HistoryNavigation.tsx @@ -27,6 +27,8 @@ export default function HistoryNavigationButton({ launcherNote, command }: Histo text={title} triggerCommand={command} onContextMenu={async (e) => { + // Prevent the native menu synchronously before awaiting history items. + e.preventDefault(); const items = webContents ? await getHistoryItems(webContents) : []; showLauncherContextMenu(launcherNote, e, { extraItems: items,