How to retain input focus when clicking on a scrollbar for selection list How to retain input focus when clicking on a scrollbar for selection list google-chrome google-chrome

How to retain input focus when clicking on a scrollbar for selection list


After investigating some of the other pickers out there, I realized that the trick is not to add an event that closes the list on blur, instead simulate a blur event by checking other possibilities by doing the following:

1. upon the opening of the list, add a click event to the document that   checks to see if the click is not on in the active input, and not on   the active list. If this is true and the click is in fact on a non-listy   part of the document, then close it.2. add an event to each list item in the suggest list (when the list is   open only) that selects the value and closes the list.3. add an keydown event to the input itself so if the user hits enter,   it changes the value and closes the list.

the new version of the javascript code can be found here: http://jsfiddle.net/SDBCe/1/