Skip to content

Commit

Permalink
Fix hotkeys interception for background hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
hlomzik committed Dec 12, 2024
1 parent 94fcfeb commit e2e1365
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ const TaskModal = observer(({ view, tasks, imageField, currentTaskId, setCurrent
event.preventDefault();
} else if (event.key === "Escape") {
onClose();
} else if (event.key === "ArrowUp" || event.key === "ArrowDown") {
// prevent Quick View from opening in a background by hotkey
} else {
// pass this event through for other keys
return;
Expand All @@ -77,7 +79,7 @@ const TaskModal = observer(({ view, tasks, imageField, currentTaskId, setCurrent
event.stopPropagation();
};

document.addEventListener("keydown", onKeyDown);
document.addEventListener("keydown", onKeyDown, { capture: true });
return () => document.removeEventListener("keydown", onKeyDown);
}, [goToNext, goToPrev, onSelect, onClose]);

Expand Down

0 comments on commit e2e1365

Please sign in to comment.