Search and Top Navigation
#7085 closed bug (fixed)
Opened March 08, 2011 09:03PM UTC
Closed March 15, 2011 06:03PM UTC
Menu click when no mouseover causes error
Reported by: | scott.moore | Owned by: | scott.moore |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.autocomplete | Version: | 1.8.10 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you use autocomplete, and have your mouse already in position over where the menu will appear and click without moving it you get an error. Basically trigger the click without triggering the mousover.
The select method in the menu code (jquery.ui.menu.js line 368) does not check that an active item exists and this causes an error in the autocomplete code (jquery.ui.autocomplete.js line 180) when it assumes an item. There are a couple fixes, one is to make the autocomplete code not assume an item and fail gracefully, and the other is to make the menu select the menu item that was clicked if it has no active item. Here is what that might look like if you replaced the menu's select method:
select: function(event) { if (!this.active) { this.active = $(event.target).closest(".ui-menu-item"); } // save active reference before closeAll triggers blur var ui = { item: this.active }; this.closeAll(); this._trigger("select", event, ui); }
This is against the latest version of the code, and that initial if block is the only new part. It works just as well in the latest released version (1.8.10)
Attachments (0)
Change History (4)
Changed March 09, 2011 02:09PM UTC by comment:1
owner: | → scott.moore |
---|---|
status: | new → pending |
Changed March 15, 2011 11:05AM UTC by comment:2
Same problem here with ff3.6.15 or IE8 on w7
How to reproduce:
- open http://jqueryui.com/demos/autocomplete/combobox.html
- set the cursor to the edit field
- press an holt key_up (menu is shown and the entry scrolls continuously)
- click some times at the first entry
- open the error console (ff) or double click at the error icon (IE)
Changed March 15, 2011 05:27PM UTC by comment:3
status: | pending → open |
---|
The suggested patch looks good, but I'd like to reproduce this in order to write a test, too. I tried reproducing on OSX/Chrome, XP/IE6 and Win7/Chrome. In each case the item gets activated on click.
What system/browser are you testing?