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': case 'ArrowLeft':
this.$refs.topNav.historyBack() this.$refs.topNav.historyBack()
break break
case 'KeyD':
this.$refs.topNav.focusSearch()
break
} }
} }
switch (event.code) { switch (event.code) {

View File

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

View File

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

View File

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