Merge pull request #41652 from nextcloud/global-search-focus-input

Focus global search input on open
pull/41683/head
Arthur Schiwon 6 months ago committed by GitHub
commit 5f159d43c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,7 +13,8 @@
<!-- Global search form -->
<div ref="globalSearch" class="global-search-modal">
<h1>{{ t('core', 'Global search') }}</h1>
<NcInputField :value.sync="searchQuery"
<NcInputField ref="searchInput"
:value.sync="searchQuery"
type="text"
:label="t('core', 'Search apps, files, tags, messages') + '...'"
@update:value="debouncedFind" />
@ -222,6 +223,15 @@ export default {
},
},
},
watch: {
isVisible(value) {
this.$nextTick(() => {
if (value) {
this.focusInput()
}
})
},
},
mounted() {
getProviders().then((providers) => {
this.providers = providers
@ -503,6 +513,9 @@ export default {
this.dateFilter.text = t('core', `Between ${this.dateFilter.startFrom.toLocaleDateString()} and ${this.dateFilter.endAt.toLocaleDateString()}`)
this.updateDateFilter()
},
focusInput() {
this.$refs.searchInput.$el.children[0].children[0].focus()
},
closeModal() {
this.$refs.globalSearchModal.close()
this.searchQuery = ''

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save