Skip to content

Commit

Permalink
fix: focus search bar on iOS devices (kulturfinder#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
nigina23 authored Aug 6, 2024
1 parent a5b0033 commit 5bc8d1e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit 5bc8d1e

Please sign in to comment.