# HG changeset patch
# User Augusto Mauch <augusto.mauch@openbravo.com>
# Date 1354708063 -3600
# Node ID 3a9d77d6df4ccceaf360730debcc77adeb21cc5a
# Parent  a895b65c70a1fa13731a5969d26560900321f9f1
Fixes issue 22390: Tab key no longer skips a field

When an option was picked in a selector in the grid using the Tab key, the focus was not put in the next field, but in the one after that.

diff --git a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
@@ -512,7 +512,9 @@
     }
 
     // only jump to the next field if the value has really been set
-    if (currentValue && this.form.focusInNextItem) {
+    // do not jump to the next field if the event has been triggered by the Tab key,
+    // to prevent a field from being skipped (see https://issues.openbravo.com/view.php?id=21419)
+    if (currentValue && this.form.focusInNextItem && isc.EH.getKeyName() !== 'Tab') {
       this.form.focusInNextItem(this.name);
     }
   },
