Skip to content

Commit

Permalink
Merge pull request #47333 from nextcloud/backport/47319/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(UnifiedSearch): Focus search input on open
  • Loading branch information
AndyScherzinger authored Aug 21, 2024
2 parents fc9a454 + ad27c5f commit 629bd67
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions core/src/components/UnifiedSearch/UnifiedSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,11 @@ export default defineComponent({
watch: {
open() {
// Load results when opened with already filled query
if (this.open && this.searchQuery) {
this.find(this.searchQuery)
if (this.open) {
this.focusInput()
if (this.searchQuery) {
this.find(this.searchQuery)
}
}
},
Expand Down Expand Up @@ -351,7 +354,11 @@ export default defineComponent({
this.$emit('update:query', this.searchQuery)
this.$emit('update:open', false)
},
focusInput() {
this.$nextTick(() => {
this.$refs.searchInput?.focus()
})
},
find(query: string) {
if (query.length === 0) {
this.results = []
Expand Down
4 changes: 2 additions & 2 deletions dist/core-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-unified-search.js.map

Large diffs are not rendered by default.

0 comments on commit 629bd67

Please sign in to comment.