From 1d31b05bfb75692f0faf0b4f9847d322ed966453 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Sat, 16 Dec 2023 13:21:01 +0800 Subject: [PATCH] fix: prevent default for arrow up and down events (#185) --- assets/search/js/navigator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/search/js/navigator.ts b/assets/search/js/navigator.ts index f561aad6d65..71a0306f58e 100644 --- a/assets/search/js/navigator.ts +++ b/assets/search/js/navigator.ts @@ -45,12 +45,14 @@ class Navigator { document.addEventListener('DOMContentLoaded', () => { const navigator = new Navigator() - keyboard.attach(['ArrowUp'], () => { + keyboard.attach(['ArrowUp'], (e: KeyboardEvent) => { navigator.prev() + e.preventDefault() }) - keyboard.attach(['ArrowDown'], () => { + keyboard.attach(['ArrowDown'], (e: KeyboardEvent) => { navigator.next() + e.preventDefault() }) }) })()