Skip to content

Commit

Permalink
Adding logic to prevent virtual keyboards (#2667)
Browse files Browse the repository at this point in the history
from closing the search bar
  • Loading branch information
MarmadileManteater authored Oct 4, 2022
1 parent 1645ab0 commit 4a70726
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default Vue.extend({
}
},
mounted: function () {
let previousWidth = window.innerWidth
if (window.innerWidth <= 680) {
this.showSearchContainer = false
}
Expand All @@ -88,7 +89,12 @@ export default Vue.extend({
}, 0)

window.addEventListener('resize', () => {
this.showSearchContainer = window.innerWidth > 680
// Don't change the status of showSearchContainer if only the height of the window changes
// Opening the virtual keyboard can trigger this resize event, but it won't change the width
if (previousWidth !== window.innerWidth) {
this.showSearchContainer = window.innerWidth > 680
previousWidth = window.innerWidth
}
})

this.debounceSearchResults = debounce(this.getSearchSuggestions, 200)
Expand Down

0 comments on commit 4a70726

Please sign in to comment.