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

pull/1145/merge
baptiste0928 2023-01-18 14:54:17 +01:00 zatwierdzone przez GitHub
rodzic 88080573db
commit fb1f407016
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -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)
}