diff --git a/frontend/src/views/TaskViewerView.vue b/frontend/src/views/TaskViewerView.vue index cbe391a..39adee4 100644 --- a/frontend/src/views/TaskViewerView.vue +++ b/frontend/src/views/TaskViewerView.vue @@ -96,8 +96,12 @@ async function loadTask(id: number) { function handleKeydown(e: KeyboardEvent) { if (e.key !== "Escape") return; + e.stopPropagation(); // prevent App.vue's global handler from also firing const active = document.activeElement as HTMLElement | null; - if (active && active !== document.body) { active.blur(); return; } + if (active && active !== document.body) { + (active as HTMLElement).blur(); + return; + } if (store.currentTask?.project_id) { router.push(`/projects/${store.currentTask.project_id}`); } else { @@ -107,9 +111,10 @@ function handleKeydown(e: KeyboardEvent) { onMounted(() => { loadTask(taskId.value); - window.addEventListener("keydown", handleKeydown); + // Capture phase so this fires before App.vue's document-level handler + window.addEventListener("keydown", handleKeydown, true); }); -onUnmounted(() => window.removeEventListener("keydown", handleKeydown)); +onUnmounted(() => window.removeEventListener("keydown", handleKeydown, true)); watch(() => route.params.id, (newId) => { if (newId) loadTask(Number(newId));