# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1491567958 -19800
#      Fri Apr 07 17:55:58 2017 +0530
# Node ID aac16f3056816b599f1b8ed09db846ad40c86dc0
# Parent  e114ed16ba90c15b2b62b1007101d564d69a7d10
Related to issue 35661 : Scanning Allowed on Search tab if "Use External Input" is enabled

* IN Main Window, Default focus will be on "_focusKeeper". Focus can be changed only if the element is "INPUT" or "SELECT" or "TEXTAREA"

Backed out changeset: e114ed16ba90

diff -r e114ed16ba90 -r aac16f305681 web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js
--- a/web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js	Wed Apr 05 16:27:17 2017 +0530
+++ b/web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js	Fri Apr 07 17:55:58 2017 +0530
@@ -120,7 +120,7 @@
   },
   keydownHandler: function (inSender, inEvent) {
     var keyCode = inEvent.keyCode;
-    if (!this.disableTapAction && (keyCode === 13 || keyCode === 32)) { //Handle ENTER and SPACE keys in buttons
+    if (keyCode === 13 || keyCode === 32) { //Handle ENTER and SPACE keys in buttons
       this.executeTapAction();
       return true;
     }
@@ -534,7 +534,6 @@
   name: 'OB.UI.SelectButton',
   kind: 'OB.UI.Button',
   classes: 'btnselect',
-  disableTapAction: true,
   tap: function () {
     if (this.model && this.model.trigger) {
       this.model.trigger('selected', this.model);
diff -r e114ed16ba90 -r aac16f305681 web/org.openbravo.mobile.core/source/component/ob-terminal-component.js
--- a/web/org.openbravo.mobile.core/source/component/ob-terminal-component.js	Wed Apr 05 16:27:17 2017 +0530
+++ b/web/org.openbravo.mobile.core/source/component/ob-terminal-component.js	Fri Apr 07 17:55:58 2017 +0530
@@ -174,12 +174,14 @@
    * When using focus keeper for barcode scanners, keep always the focus there
    */
   keeperBlur: function (inSender, inEvent) {
-    if (this.scanMode) {
-      OB.debug('keeperBlur');
-      OB.MobileApp.view.setFocusOnFocusKeeper();
-    } else {
-      OB.debug('skip keeperBlur');
-    }
+    setTimeout(function () {
+      if (OB.MobileApp.view.scanMode && (document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'SELECT' && document.activeElement.tagName !== 'TEXTAREA')) {
+        OB.debug('keeperBlur');
+        OB.MobileApp.view.setFocusOnFocusKeeper();
+      } else {
+        OB.debug('skip keeperBlur');
+      }
+    }, 10);
   },
 
   /**
@@ -234,7 +236,6 @@
 
         if (!me.scanMode) {
           return;
-
         }
 
         // using timeout due problems in android stock browser because of 2 reasons:
@@ -245,7 +246,7 @@
         //   2. if timeout is not used, on-screen keyboard is shown when settin focus in
         //      keeper
         setTimeout(function () {
-          if (this.scanMode || (document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'SELECT' && document.activeElement.tagName !== 'TEXTAREA')) {
+          if (me.scanMode && (document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'SELECT' && document.activeElement.tagName !== 'TEXTAREA')) {
             me.setFocusOnFocusKeeper();
           }
         }, 500);
diff -r e114ed16ba90 -r aac16f305681 web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js
--- a/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js	Wed Apr 05 16:27:17 2017 +0530
+++ b/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js	Fri Apr 07 17:55:58 2017 +0530
@@ -831,9 +831,8 @@
       me.filteringBy();
     });
     setTimeout(function () {
-      OB.MobileApp.view.scanningFocus(false);
       me.parent.$.searchCharacteristicTabContent.$.searchProductCharacteristicHeader.$.productFilterText.focus();
-    }, 200);
+    }, 100);
   },
   components: [{
     kind: 'OB.UI.SearchProductCharacteristicHeader',
