Select search text on focus (#1201)

This commit is contained in:
Svallinn 2021-04-15 19:30:26 +00:00 committed by GitHub
parent ebc829cef0
commit 1fd08af136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 1 deletions

View File

@ -27,6 +27,10 @@ export default Vue.extend({
type: Boolean,
default: false
},
selectOnFocus: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
@ -130,6 +134,13 @@ export default Vue.extend({
handleInputBlur: function () {
if (!this.searchState.isPointerInList) { this.searchState.showOptions = false }
},
handleFocus: function(e) {
this.searchState.showOptions = true
if (this.selectOnFocus) {
e.target.select()
}
}
}
})

View File

@ -27,7 +27,7 @@
:placeholder="placeholder"
:disabled="disabled"
@input="e => handleInput(e.target.value)"
@focus="searchState.showOptions = true"
@focus="handleFocus"
@blur="handleInputBlur"
@keydown="e => handleKeyDown(e.keyCode)"
>

View File

@ -44,6 +44,7 @@
:placeholder="$t('Search / Go to URL')"
class="searchInput"
:is-search="true"
:select-on-focus="true"
:data-list="searchSuggestionsDataList"
@input="getSearchSuggestionsDebounce"
@click="goToSearch"

View File

@ -70,6 +70,7 @@
</div>
<ft-input
:placeholder="$t('Channel.Search Channel')"
:select-on-focus="true"
class="channelSearch"
@click="newSearch"
/>