@@ -281,7 +281,7 @@ function onSearchBarClick(event: PointerEvent) {
281
281
/* Search keyboard selection */
282
282
283
283
const selectedIndex = ref (- 1 )
284
- const disableMouseOver = ref (false )
284
+ const disableMouseOver = ref (true )
285
285
286
286
watch (results , (r ) => {
287
287
selectedIndex .value = r .length ? 0 : - 1
@@ -400,6 +400,16 @@ function formMarkRegex(terms: Set<string>) {
400
400
' gi'
401
401
)
402
402
}
403
+
404
+ function onMouseMove(e : MouseEvent ) {
405
+ if (! disableMouseOver .value ) return
406
+ const el = (e .target as HTMLElement )?.closest <HTMLAnchorElement >(' .result' )
407
+ const index = Number .parseInt (el ?.dataset .index ! )
408
+ if (index >= 0 && index !== selectedIndex .value ) {
409
+ selectedIndex .value = index
410
+ }
411
+ disableMouseOver .value = false
412
+ }
403
413
</script >
404
414
405
415
<template >
@@ -487,7 +497,7 @@ function formMarkRegex(terms: Set<string>) {
487
497
:role =" results?.length ? 'listbox' : undefined"
488
498
:aria-labelledby =" results?.length ? 'localsearch-label' : undefined"
489
499
class =" results"
490
- @mousemove =" disableMouseOver = false "
500
+ @mousemove =" onMouseMove "
491
501
>
492
502
<li
493
503
v-for =" (p, index) in results"
@@ -506,6 +516,7 @@ function formMarkRegex(terms: Set<string>) {
506
516
@mouseenter =" !disableMouseOver && (selectedIndex = index)"
507
517
@focusin =" selectedIndex = index"
508
518
@click =" $emit('close')"
519
+ :data-index =" index"
509
520
>
510
521
<div >
511
522
<div class =" titles" >
0 commit comments