We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6cdbcfb commit bb6bcdbCopy full SHA for bb6bcdb
resources/views/partials/quick-search-dropdown.blade.php
@@ -9,6 +9,7 @@ class="quick-search__input"
9
x-ref="quickSearch"
10
x-on:keydown.down.prevent="focusFirstResult"
11
x-on:keydown.up.prevent="focusLastResult"
12
+ x-on:keydown.enter="navigateToFirstResult"
13
x-on:focus="searchPerformed = true"
14
/>
15
<template x-if="searchResults === null">
@@ -90,6 +91,11 @@ class="quick-search__result-type"
90
91
this.searchResults = [];
92
this.searchPerformed = false;
93
},
94
+ navigateToFirstResult() {
95
+ if (Array.isArray(this.searchResults) && this.searchResults.length > 0) {
96
+ window.location.href = this.searchResults[0].url;
97
+ }
98
+ },
99
focusFirstResult() {
100
document.querySelector('[x-ref="searchResults"]').querySelector('a').focus();
101
0 commit comments