Skip to content

Commit

Permalink
fix: prevent default for arrow up and down events (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Dec 16, 2023
1 parent 4477111 commit 1d31b05
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions assets/search/js/navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})
})()

0 comments on commit 1d31b05

Please sign in to comment.