From 5bc8d1e7ef2f111617f50592519537c74c80d307 Mon Sep 17 00:00:00 2001 From: Niginabonu Isamukhamedova <85829510+nigina23@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:10:51 +0200 Subject: [PATCH] fix: focus search bar on iOS devices (#140) --- src/views/Dashboard.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 2902c82..e45dca0 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -278,14 +278,15 @@ export default { }, methods: { onToggleSearchbar() { - if (this.searchbarOpen) { - this.$refs.searchbar.blurInput() - this.searchbarOpen = !this.searchbarOpen - this.$store.dispatch('filters/updateSearchQuery', '') - } else { - this.searchbarOpen = !this.searchbarOpen - this.$refs.searchbar.focusInput() - } + this.searchbarOpen = !this.searchbarOpen + this.$nextTick(() => { + if (this.searchbarOpen) { + this.$refs.searchbar.$el.querySelector('input').focus() + } else { + this.$refs.searchbar.blurInput() + this.$store.dispatch('filters/updateSearchQuery', '') + } + }) }, searchBarEnterHandler(value) { this.$router.push(`/${this.$route.params.locale}/institutions/list?searchQuery=${value}`)