Skip to content

Commit

Permalink
feat(search): select first result on enter press (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste0928 authored Jan 18, 2023
1 parent 8808057 commit fb1f407
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/search/SearchWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ const shift = (delta: number) => index.value = (index.value + delta % results.va
const activate = () => {
const currentIndex = index.value
index.value = -1
if (query.value.length === 0)
return
(document.activeElement as HTMLElement).blur()
// Disable until search page is implemented
if (currentIndex === -1)
// Disable redirection until search page is implemented
if (currentIndex === -1) {
index.value = 0
// router.push(`/search?q=${query.value}`)
return
}
(document.activeElement as HTMLElement).blur()
index.value = -1
router.push(results.value[currentIndex].to)
}
Expand Down

0 comments on commit fb1f407

Please sign in to comment.