diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index 70624e42..951a7536 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -281,7 +281,7 @@ function onSearchBarClick(event: PointerEvent) { /* Search keyboard selection */ const selectedIndex = ref(-1) -const disableMouseOver = ref(false) +const disableMouseOver = ref(true) watch(results, (r) => { selectedIndex.value = r.length ? 0 : -1 @@ -400,6 +400,16 @@ function formMarkRegex(terms: Set) { 'gi' ) } + +function onMouseMove(e: MouseEvent) { + if (!disableMouseOver.value) return + const el = (e.target as HTMLElement)?.closest('.result') + const index = Number.parseInt(el?.dataset.index!) + if (index >= 0 && index !== selectedIndex.value) { + selectedIndex.value = index + } + disableMouseOver.value = false +}