From 79cd3433f5fdb2bcbe7f7fde1ebf786b57e9eac0 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 26 Feb 2026 23:42:22 +0100 Subject: [PATCH] refactor(shortcuts): use event.code for raw keyboard handlers Change e.key to e.code in global keyboard shortcut handlers for consistency with the new event.code-based shortcut system: - ProjectList.vue: 'j'/'k'/'Enter' -> 'KeyJ'/'KeyK'/'Enter' - useGanttBar.ts: 'ArrowLeft'/'ArrowRight' (identical values, for consistency) - Modal.vue: 'Escape' (identical value, for consistency) --- frontend/src/components/misc/Modal.vue | 2 +- .../src/components/project/views/ProjectList.vue | 6 +++--- frontend/src/composables/useGanttBar.ts | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/misc/Modal.vue b/frontend/src/components/misc/Modal.vue index 5a05e8025..f11763339 100644 --- a/frontend/src/components/misc/Modal.vue +++ b/frontend/src/components/misc/Modal.vue @@ -101,7 +101,7 @@ watchEffect(() => { }) function onKeydown(e: KeyboardEvent) { - if (e.key === 'Escape') { + if (e.code === 'Escape') { if (e.isComposing) { return } diff --git a/frontend/src/components/project/views/ProjectList.vue b/frontend/src/components/project/views/ProjectList.vue index 270f99d14..0ff8a64d1 100644 --- a/frontend/src/components/project/views/ProjectList.vue +++ b/frontend/src/components/project/views/ProjectList.vue @@ -322,13 +322,13 @@ function handleListNavigation(e: KeyboardEvent) { return } - if (e.key === 'j') { + if (e.code === 'KeyJ') { e.preventDefault() focusTask(Math.min(focusedIndex.value + 1, tasks.value.length - 1)) return } - if (e.key === 'k') { + if (e.code === 'KeyK') { e.preventDefault() if (focusedIndex.value === -1) { focusTask(tasks.value.length - 1) @@ -345,7 +345,7 @@ function handleListNavigation(e: KeyboardEvent) { return } - if (e.key === 'Enter') { + if (e.code === 'Enter') { if (e.isComposing) { return } diff --git a/frontend/src/composables/useGanttBar.ts b/frontend/src/composables/useGanttBar.ts index dcfadcc54..4cc68ebc5 100644 --- a/frontend/src/composables/useGanttBar.ts +++ b/frontend/src/composables/useGanttBar.ts @@ -64,31 +64,31 @@ export function useGanttBar(options: UseGanttBarOptions) { function onKeyDown(e: KeyboardEvent) { // task expanding if (e.shiftKey) { - if (e.key === 'ArrowLeft') { + if (e.code === 'ArrowLeft') { e.preventDefault() changeSize('left', 1) } - if (e.key === 'ArrowRight') { + if (e.code === 'ArrowRight') { e.preventDefault() changeSize('right', 1) } } // task shrinking else if (e.ctrlKey) { - if (e.key === 'ArrowLeft') { + if (e.code === 'ArrowLeft') { e.preventDefault() changeSize('left', -1) } - if (e.key === 'ArrowRight') { + if (e.code === 'ArrowRight') { e.preventDefault() changeSize('right', -1) } } // task movement - else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') { + else if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') { e.preventDefault() - const dir = e.key === 'ArrowRight' ? 1 : -1 + const dir = e.code === 'ArrowRight' ? 1 : -1 const newStart = new Date(options.model.start) newStart.setDate(newStart.getDate() + dir) const newEnd = new Date(options.model.end)