fix(app): support ctrl-n/p in lists (#10036)

This commit is contained in:
Ryan Miville
2026-01-22 09:33:35 -05:00
committed by GitHub
parent e85b953087
commit 9aa54fd71b

View File

@@ -82,6 +82,15 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
const selectedIndex = flat().findIndex((x) => props.key(x) === list.active())
const selected = flat()[selectedIndex]
if (selected) props.onSelect?.(selected, selectedIndex)
} else if (event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
if (event.key === "n" || event.key === "p") {
event.preventDefault()
const navEvent = new KeyboardEvent("keydown", {
key: event.key === "n" ? "ArrowDown" : "ArrowUp",
bubbles: true,
})
list.onKeyDown(navEvent)
}
} else {
// Skip list navigation for text editing shortcuts (e.g., Option+Arrow, Option+Backspace on macOS)
if (event.altKey || event.metaKey) return