From cc79eb5c6c650cee5dafa69cb947966861b7f82e Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Sat, 4 Dec 2021 07:04:44 +0000 Subject: [PATCH] Fix for searching when composing in search box (#519) Co-authored-by: jloqfjgk <68487118+jloqfjgk@users.noreply.github.com> --- src/components/Navigation.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue index c996f919..1fd0197e 100644 --- a/src/components/Navigation.vue +++ b/src/components/Navigation.vue @@ -24,6 +24,7 @@ :title="$t('actions.search')" :placeholder="$t('actions.search')" @keyup="onKeyUp" + @keypress="onKeyPress" @focus="onInputFocus" @blur="onInputBlur" /> @@ -57,6 +58,7 @@ :title="$t('actions.search')" :placeholder="$t('actions.search')" @keyup="onKeyUp" + @keypress="onKeyPress" @focus="onInputFocus" @blur="onInputBlur" /> @@ -92,6 +94,12 @@ export default { }, methods: { onKeyUp(e) { + if (e.key === "ArrowUp" || e.key === "ArrowDown") { + e.preventDefault(); + } + this.$refs.searchSuggestions.onKeyUp(e); + }, + onKeyPress(e) { if (e.key === "Enter") { e.target.blur(); this.$router.push({ @@ -99,10 +107,7 @@ export default { query: { search_query: this.searchText }, }); return; - } else if (e.key === "ArrowUp" || e.key === "ArrowDown") { - e.preventDefault(); } - this.$refs.searchSuggestions.onKeyUp(e); }, onInputFocus() { this.suggestionsVisible = true;