From 80227409967a85c12e559f9576bd2e27caa8ae0b Mon Sep 17 00:00:00 2001 From: salmonumbrella <182032677+salmonumbrella@users.noreply.github.com> Date: Wed, 24 Dec 2025 04:51:42 -0800 Subject: [PATCH] feat: add vim-style keyboard navigation to SmartBlocks menu Add Ctrl-n/Ctrl-j for down and Ctrl-p/Ctrl-k for up navigation in the workflow dropdown, complementing existing arrow key support. --- src/SmartblocksMenu.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SmartblocksMenu.tsx b/src/SmartblocksMenu.tsx index 2c4cb87..ec496c6 100644 --- a/src/SmartblocksMenu.tsx +++ b/src/SmartblocksMenu.tsx @@ -108,13 +108,19 @@ const SmartblocksMenu = ({ const keydownListener = useCallback( (e: KeyboardEvent) => { if (!menuRef.current) return; - if (e.key === "ArrowDown") { + const isDown = + e.key === "ArrowDown" || + (e.ctrlKey && (e.key === "n" || e.key === "j")); + const isUp = + e.key === "ArrowUp" || + (e.ctrlKey && (e.key === "p" || e.key === "k")); + if (isDown) { const index = Number(menuRef.current.getAttribute("data-active-index")); const count = menuRef.current.childElementCount; setActiveIndex((index + 1) % count); e.stopPropagation(); e.preventDefault(); - } else if (e.key === "ArrowUp") { + } else if (isUp) { const index = Number(menuRef.current.getAttribute("data-active-index")); const count = menuRef.current.childElementCount; setActiveIndex((index - 1 + count) % count);