fixes issue
31377: Combo value not selected after open drop-down with keyboard
Now the behavior of the combos when opening the drop-down with the keyboard is the same as when clicking on the arrow button with the mouse.
To solve this problem the handleKeyPress function is overriden to select the current combo value when ALT + keyboard down shortcut is pressed. Also it is checked that the combo is on a valid state before showing the drop-down.
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js Thu Nov 05 16:49:15 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js Thu Nov 05 19:00:37 2015 +0100
@@ -42,5 +42,25 @@
showPicker: function () {
this.selectValue();
this.Super('showPicker', arguments);
+ },
+
+ // Override handleKeyPress to ensure that we select the text when pressing the keyboard shortcut of the drop-down
+ // See issue #31377
+ handleKeyPress: function () {
+ if (this.keyboardShortcutPressed()) {
+ this.selectValue();
+ }
+ return this.Super('handleKeyPress', arguments);
+ },
+
+ // Checks if the ALT + keyboard down key combination has been pressed on a valid state of the combo box
+ keyboardShortcutPressed: function () {
+ if (this.hasFocus && !this.isReadOnly()) {
+ var keyName = isc.EH.lastEvent.keyName;
+ if (keyName === 'Arrow_Down' && isc.EH.altKeyDown()) {
+ return true;
+ }
+ }
+ return false;
}
});
\ No newline at end of file