summaryrefslogtreecommitdiff
path: root/addons/barcodes/static
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-06-07 11:43:07 +0200
committerChristophe Simonis <chs@odoo.com>2018-06-07 11:43:07 +0200
commit2ab7ad83618dcffd32b39e3a54ae500514444476 (patch)
treeae4398707a5c1e126895a80429693599ba65dc17 /addons/barcodes/static
parente0591346a4ad4d256bc2e4e49bfa5a8e21f22f45 (diff)
parentc00df146547dca9c4dea6f39c1f0408ac84ec2d7 (diff)
[MERGE] forward port branch saas-11.3 up to c00df146547
Diffstat (limited to 'addons/barcodes/static')
-rw-r--r--addons/barcodes/static/src/js/barcode_events.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/addons/barcodes/static/src/js/barcode_events.js b/addons/barcodes/static/src/js/barcode_events.js
index a2e5808f8be..2d602a36b97 100644
--- a/addons/barcodes/static/src/js/barcode_events.js
+++ b/addons/barcodes/static/src/js/barcode_events.js
@@ -64,12 +64,14 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, {
'position': 'fixed',
'top': '50%',
'transform': 'translateY(-50%)',
- 'opacity': 0,
+ 'z-index': '-1',
},
});
+ // Avoid to show autocomplete for a non appearing input
+ this.$barcodeInput.attr('autocomplete', 'off');
}
- this.__removeBarcodeField = _.debounce(this._removeBarcodeField, this.inputTimeOut);
+ this.__blurBarcodeInput = _.debounce(this._blurBarcodeInput, this.inputTimeOut);
},
handle_buffered_keys: function() {
@@ -232,7 +234,7 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, {
this.max_time_between_keys_in_ms);
}
// if the barcode input doesn't receive keydown for a while, remove it.
- this.__removeBarcodeField();
+ this.__blurBarcodeInput();
}
},
@@ -247,21 +249,22 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, {
var barcodeValue = this.$barcodeInput.val();
if (barcodeValue.match(this.regexp)) {
core.bus.trigger('barcode_scanned', barcodeValue, $(e.target).parent()[0]);
- this.$barcodeInput.val('');
+ this._blurBarcodeInput();
}
},
/**
- * Remove the temporary input created to store the barcode value.
- * If nothing happens, this input will be removed, so the focus will be lost
- * and the virtual keyboard on mobile devices will be closed.
+ * Removes the value and focus from the barcode input.
+ * If nothing happens, the focus will be lost and
+ * the virtual keyboard on mobile devices will be closed.
*
* @private
*/
- _removeBarcodeField: function () {
+ _blurBarcodeInput: function () {
if (this.$barcodeInput) {
- // Reset the value and remove from the DOM.
- this.$barcodeInput.val('').remove();
+ // Close the virtual keyboard on mobile browsers
+ // FIXME: actually we can't prevent keyboard from opening
+ this.$barcodeInput.val('').blur();
}
},