From 49f197b1841dca7c8ac200284d999b1d15974330 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Mon, 16 Oct 2023 16:16:03 +0200 Subject: [PATCH] shopfloor_mobile_base: fix searchbar focus --- .../static/wms/src/components/searchbar/searchbar.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js b/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js index bed590947fe..381f6cb8514 100644 --- a/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js +++ b/shopfloor_mobile_base/static/wms/src/components/searchbar/searchbar.js @@ -115,7 +115,15 @@ export var Searchbar = Vue.component("searchbar", { }, methods: { capture_focus: function () { - if (this.autofocus) this.$refs.searchbar.focus(); + if (this.autofocus && this.$refs.searchbar) { + // We need to use both "focus" and "click" in combination + // to make sure that the searchbar is fully focused and ready for scanning + // without having to manually tap on it. + // Using simply one or the other is not enough + // to always be able to input any scanned text. + this.$refs.searchbar.focus(); + this.$refs.searchbar.click(); + } }, show_virtual_keyboard: function (elem) { elem.inputMode = this.input_inputmode;