Fix search input shortcut (#2140)

* Add handler for slash shortcut

* Fix lint errors

* Change Slash shortcut to Alt+KeyD
This commit is contained in:
vallode 2022-04-08 04:45:22 +02:00 committed by GitHub
parent 6559732207
commit 86bdb5e2ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

View File

@ -303,6 +303,9 @@ export default Vue.extend({
case 'ArrowLeft':
this.$refs.topNav.historyBack()
break
case 'KeyD':
this.$refs.topNav.focusSearch()
break
}
}
switch (event.code) {

View File

@ -37,6 +37,7 @@
/>
<input
:id="id"
ref="input"
v-model="inputData"
:list="idDataList"
class="ft-input"

View File

@ -36,6 +36,10 @@ export default Vue.extend({
return this.$store.getters.getEnableSearchSuggestions
},
searchInput: function () {
return this.$refs.searchInput.$refs.input
},
searchSettings: function () {
return this.$store.getters.getSearchSettings
},
@ -197,6 +201,10 @@ export default Vue.extend({
this.showFilters = false
},
focusSearch: function () {
this.searchInput.focus()
},
getSearchSuggestionsDebounce: function (query) {
if (this.enableSearchSuggestions) {
this.debounceSearchResults(query)

View File

@ -66,6 +66,7 @@
<div class="middle">
<div class="searchContainer">
<ft-input
ref="searchInput"
:placeholder="$t('Search / Go to URL')"
class="searchInput"
:is-search="true"