Skip to main content

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:

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 ( 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 (! {
       = $(".ui-menu-item");
            // save active reference before closeAll triggers blur            
            var ui = {
            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 jzaefferer comment:1

owner: → scott.moore
status: newpending

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?

Changed March 15, 2011 11:05AM UTC by t34 comment:2

Same problem here with ff3.6.15 or IE8 on w7

How to reproduce:

  • open
  • 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 scottgonzalez comment:3

status: pendingopen

Changed March 15, 2011 06:03PM UTC by Scott González comment:4

resolution: → fixed
status: openclosed

Menu: Handle clicking on a menu item without hovering it first. Fixes #7085 - Menu click when no mouseover causes error.

Changeset: da67ece506ab69ef2d6d6bc6c1cf60be48776d4c