From 58a52f65cc9d581ca2d59c8c7473e4ca505cc048 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sat, 13 Jun 2026 14:32:34 +0800 Subject: [PATCH] fix: enhance contextmenu handler for editable elements --- apps/desktop/src/App.vue | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index dc3099066b..8a61d1fd3d 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -956,8 +956,35 @@ async function reconnectRestoredTabs() { function handleContextMenu(e: MouseEvent) { const target = e.target as HTMLElement; - if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) return; - if (target.closest("[data-reka-collection-item], [data-radix-vue-collection-item], [data-context-menu]")) return; + + // Check if target is a standard editable input element + if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) { + if (import.meta.env.DEV) { + console.debug("[contextmenu] Allowing for input/textarea:", target); + } + return; + } + + // Check if target or any parent has contenteditable attribute + if (target.isContentEditable || target.closest("[contenteditable]")) { + if (import.meta.env.DEV) { + console.debug("[contextmenu] Allowing for contenteditable:", target); + } + return; + } + + // Check if target is within a custom context menu container or collection item + if (target.closest("[data-reka-collection-item], [data-radix-vue-collection-item], [data-context-menu]")) { + if (import.meta.env.DEV) { + console.debug("[contextmenu] Allowing for custom context menu container:", target); + } + return; + } + + // Prevent default context menu for all other elements + if (import.meta.env.DEV) { + console.debug("[contextmenu] Preventing default for:", target); + } e.preventDefault(); }