Skip to content

Commit cf59575

Browse files
committed
fix(UnifiedSearch): Focus search input on open
Resolves : #47056 Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
1 parent ba9638e commit cf59575

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

core/src/components/UnifiedSearch/UnifiedSearchModal.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,11 @@ export default defineComponent({
304304
watch: {
305305
open() {
306306
// Load results when opened with already filled query
307-
if (this.open && this.searchQuery) {
308-
this.find(this.searchQuery)
307+
if (this.open) {
308+
this.focusInput()
309+
if (this.searchQuery) {
310+
this.find(this.searchQuery)
311+
}
309312
}
310313
},
311314
@@ -351,7 +354,11 @@ export default defineComponent({
351354
this.$emit('update:query', this.searchQuery)
352355
this.$emit('update:open', false)
353356
},
354-
357+
focusInput() {
358+
this.$nextTick(() => {
359+
this.$refs.searchInput?.focus()
360+
})
361+
},
355362
find(query: string) {
356363
if (query.length === 0) {
357364
this.results = []

0 commit comments

Comments
 (0)