mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 20:29:08 +01:00
feat(search): select first result on enter press (#1289)
This commit is contained in:
parent
88080573db
commit
fb1f407016
1 changed files with 7 additions and 5 deletions
|
@ -37,17 +37,19 @@ const shift = (delta: number) => index.value = (index.value + delta % results.va
|
||||||
|
|
||||||
const activate = () => {
|
const activate = () => {
|
||||||
const currentIndex = index.value
|
const currentIndex = index.value
|
||||||
index.value = -1
|
|
||||||
|
|
||||||
if (query.value.length === 0)
|
if (query.value.length === 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
(document.activeElement as HTMLElement).blur()
|
// Disable redirection until search page is implemented
|
||||||
|
if (currentIndex === -1) {
|
||||||
// Disable until search page is implemented
|
index.value = 0
|
||||||
if (currentIndex === -1)
|
|
||||||
// router.push(`/search?q=${query.value}`)
|
// router.push(`/search?q=${query.value}`)
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
(document.activeElement as HTMLElement).blur()
|
||||||
|
index.value = -1
|
||||||
|
|
||||||
router.push(results.value[currentIndex].to)
|
router.push(results.value[currentIndex].to)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue