From a366a0bcc6ff5530bfde8238ceabcb7400e03f28 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sat, 18 Nov 2023 12:37:48 -0800 Subject: [PATCH] Improve Gallery keyboard navigation --- frontend/src/components/Gallery.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/Gallery.vue b/frontend/src/components/Gallery.vue index 370e1e6..6ec5902 100644 --- a/frontend/src/components/Gallery.vue +++ b/frontend/src/components/Gallery.vue @@ -107,6 +107,10 @@ defineExpose({ const increment = (i: number, d: number) => mod(i + d, N + 1) const index = store.cursor ? docs.findIndex(doc => doc.key === store.cursor) : N + // Stop navigation sideways away from the grid (only with up/down) + if (ev && index === 0 && ev.key === "ArrowLeft") return + if (ev && index === N - 1 && ev.key === "ArrowRight") return + // Calculate new position let moveto if (index === N) moveto = d > 0 ? 0 : N - 1 else {