fix(launch_bar): some context menus intercepted by browser

This commit is contained in:
Elian Doran
2026-04-16 23:00:41 +03:00
parent 999bfbc118
commit 8ec6125ec4
2 changed files with 5 additions and 0 deletions

View File

@@ -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) : [];

View File

@@ -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<string>(launcherNote, e, {
extraItems: items,