diff --git a/packages/ui/src/lib/components/ContextMenu.svelte b/packages/ui/src/lib/components/ContextMenu.svelte index aa70d7cba6..a5c8525834 100644 --- a/packages/ui/src/lib/components/ContextMenu.svelte +++ b/packages/ui/src/lib/components/ContextMenu.svelte @@ -329,13 +329,6 @@ return isVisible; } - function handleKeyNavigation(e: KeyboardEvent) { - if (e.key === 'Escape') { - e.preventDefault(); - close(); - } - } - $effect(() => { if (!menuContainer) return; const config = { attributes: false, childList: true, subtree: true }; @@ -358,17 +351,26 @@ {#if isVisible} -
- + +
{ + close(); + return true; + } + }} + use:portal={'body'} + >
import Icon from '$components/Icon.svelte'; import Tooltip from '$components/Tooltip.svelte'; + import { focusable } from '$lib/focus/focusable'; import { keysStringToArr } from '$lib/utils/hotkeys'; import { getContext } from 'svelte'; import type iconsJson from '@gitbutler/ui/data/icons.json'; @@ -62,12 +63,13 @@