Autocomplete with autoFill - modifier keypress error
I am using jQuery UI 1.6rc2. I believe I found a bug with autocomplete
fields that use autoFill. Here's the scenario:
1. I visit a page that has an autocomplete with autofill input field
(it is designed to accept a time)
2. I want to input "12:45 pm" so I begin typing "12" which brings up
a list of suggestions
3. I press shift to type a colon ":" and the autoFilled text is
deselected and my colon ends up at the end (like this "12:00 pm:"
I also noticed that the text is deselected when I press other modifier
keys such as Ctrl or Alt.
I fixed this problem (at least in Firefox) by making the adjustments
below (although since I'm not familiar with the autocomplete code, I
don't know if it is the best fix)
To the KEY object, I added:
SHIFT: 16,
CTRL: 17,
ALT: 18
And to the very top of the onChange function, I added:
if ( jQuery.inArray(lastKeyPressCode, [KEY.SHIFT, KEY.CTRL,
KEY.ALT]) !== -1 )
return;