From 4a707262161d96b4c33c0567e1ad6e1883f2a6d0 Mon Sep 17 00:00:00 2001 From: Emma Date: Mon, 3 Oct 2022 22:54:31 -0400 Subject: [PATCH] Adding logic to prevent virtual keyboards (#2667) from closing the search bar --- src/renderer/components/top-nav/top-nav.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/top-nav/top-nav.js b/src/renderer/components/top-nav/top-nav.js index f843b818..dafbd670 100644 --- a/src/renderer/components/top-nav/top-nav.js +++ b/src/renderer/components/top-nav/top-nav.js @@ -76,6 +76,7 @@ export default Vue.extend({ } }, mounted: function () { + let previousWidth = window.innerWidth if (window.innerWidth <= 680) { this.showSearchContainer = false } @@ -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)