From 00ef2f1db0369f50b3b634508e798b19b9525b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Wed, 13 Sep 2023 05:25:19 +0200 Subject: [PATCH] fix(theme): local search enter key with the search result (#2937) --- src/client/theme-default/components/VPLocalSearchBox.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index 0da16863..bf0ab4c3 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -311,12 +311,12 @@ onKeyStroke('Enter', (e) => { if (e.target instanceof HTMLButtonElement && e.target.type !== 'submit') return - if (e.target instanceof HTMLInputElement) { + const selectedPackage = results.value[selectedIndex.value] + if (e.target instanceof HTMLInputElement && !selectedPackage) { e.preventDefault() return } - const selectedPackage = results.value[selectedIndex.value] if (selectedPackage) { router.go(selectedPackage.id) emit('close')