summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Dieudonne <adr@odoo.com>2019-03-04 13:47:27 +0000
committerAdrien Dieudonne <adr@odoo.com>2019-03-11 09:57:56 +0000
commit1cdf2bdaf6fb8de398384b04287e564bfcd063ec (patch)
tree334691bff55dab31fff7129744a1f90bd8ab558b
parent07e89c5c8d9f3b793a380ecf5ac0cdfee76fcf76 (diff)
[FIX] barcodes: let focus in number, password, tel, phone inputs
Before this commit, users wasn't able to input values in some input elements like password, email and phone in mobile. Steps to reproduce: - Go to user - Select Preferences - Select Change password - Try to input something => The focus was lost and the keyboard disappeared In fact, a hidden input always have the focus when no other fields need it. This input is used to intercept a value from a barcode scanner. So now, we added some input types to avoid to set the focus on the barcode input. It's quite difficult to test this feature because we aren't allow to simultate a keyboard to write in a input field. See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent Plus, we don't have the focus in mobile except if we have the cursor inside the window. So, we can't test focused elements or input values. opw-1936712 opw-1948266 closes odoo/odoo#31566 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
-rw-r--r--addons/barcodes/static/src/js/barcode_events.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/barcodes/static/src/js/barcode_events.js b/addons/barcodes/static/src/js/barcode_events.js
index 0f2849525de..1cb815f22e4 100644
--- a/addons/barcodes/static/src/js/barcode_events.js
+++ b/addons/barcodes/static/src/js/barcode_events.js
@@ -220,7 +220,8 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, {
* @param {jQuery.Event} e keydown event
*/
_listenBarcodeScanner: function (e) {
- if (!$('input:text:focus, textarea:focus, [contenteditable]:focus').length) {
+ if ($(':focus').not('input:text, textarea, [contenteditable], ' +
+ '[type="email"], [type="number"], [type="password"], [type="tel"]')) {
$('body').append(this.$barcodeInput);
this.$barcodeInput.focus();
}