Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(search): select first result on enter press #1289

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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