Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1145
Handling the Tab key
posted

We have barcode scanners that we're using to scan an item from a combo box. What we do is, in the KeyDown event, we check for a tab key (or enter key, as some scanners use that) and then we check to see if the text in the combo matches an item. If it does, then what we want to do is clear out the combo's textbox, close the dropdown, and keep the focus inside the combo.

Specifically, what I'm doing at the end of my code is: 

    warehouseItemCombo.igCombo('text', '', false);
    warehouseItemCombo.igCombo('setFocus');
    e.stopImmediatePropagation();
    e.preventDefault();

 The problem is, my combo remains open (dropped down) with the item that matches the scanned barcode in the textbox, and I can't really figure out where the focus is, but it doesn't appear to be in teh combo.

How can I make this work the way I want? Incidentally, this all works fine with just the enter key. It's with the tab key that the behavior is problematic.

 

Parents
  • 10240
    posted

    Hi Pete,

    When you are checking for the tab key in the keydown event, what are you then doing with a tab key press? The default behavior of the tab key is to take focus from the current element and tab over to the 'next' element of the page, whichever that is. This will explain why you are finding that the focus as shifted away from the igCombo.

    What you will need to do is change the behavior of the tab key when handling keydown, for the behavior you need for it to have.

     

Reply Children