Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7799 closed bug (fixed)

Autocomplete regression - Cannot type '&' in IE and Chrome

Reported by: Antoine DESSAIGNE Owned by:
Priority: minor Milestone: git
Component: ui.autocomplete Version: git (not yet released)
Keywords: Cc:
Blocked by: Blocking:

Description

Hi,

I've just found a regression with the 1.9-m6 release: it is impossible to type a '&' in an autocomplete field.

This is due to this commit: https://github.com/jquery/jquery-ui/blob/bdfc6d532c68c092a83461a8b76840719294313f/ui/jquery.ui.autocomplete.js

The problem is that the keyCode on the keydown event is different from the keycode from the keypress event. And thus, it mixed up the 'UP' arrow and the '&'

Here an analysis of the trouble:

Chrome 14 IE 9 Firefox 7
Can '&' be typed in autocomplete NO NO YES
'&' keydown code 49 49 49
'&' keypress code 38 38 0
'UP' keydown code 38 38 38
'UP' keypress code No event No event 38
keydown repeat (1) YES YES YES

(1) This indicates whether or not the keydown event is repeated when we keep the keyboard key down.

Since, when holding down a key, the keydown event is triggered multiple times in Firefox 7, I would remove all together the keyCode section handling in the keypress.autocomplete binding method.

Here is a sample demo code: http://pastebin.com/zz54F3Bv. I cannot use either jsFiddle nor jsbin since they don't have the latest version of jQuery UI. The autocomplete field helps seeing whether or not we can type the '&'. The text field displays the events when typing something.

Thanks,

Antoine.

Change History (3)

comment:1 Changed 11 years ago by Scott González

Resolution: fixed
Status: newclosed

Autocomplete: Avoid handling keypress when keydown modified the search term. Fixes #7799 - Autocomplete regression - Cannot type '&' in IE and Chrome.

Changeset: 63374dcb520f5ad7104ccb57b8eb01dca4087889

comment:2 Changed 11 years ago by Scott González

Milestone: 1.9git

comment:3 Changed 11 years ago by Antoine DESSAIGNE

Thanks a lot, it's working perfectly!

Note: See TracTickets for help on using tickets.