Skip to main content

Search and Top Navigation

#7484 closed enhancement (duplicate)

Opened June 16, 2011 02:34PM UTC

Closed November 30, 2011 04:20PM UTC

Last modified November 30, 2011 04:20PM UTC

Mouse and keyboard selection should have the same behavior

Reported by: dpalita Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.13
Keywords: Cc:
Blocked by: Blocking:
Description

When you select an item in the list using the up/down - enter keys, the focus stays in the input (which is fine).

But when you do this with a mouse click, the focus is momentarily on the item ...

In my use case I have validation bound to the input blur event that triggers an error because it is based on actions taken in the "select" method.

I know there are workarounds (binding on "change" for example) but it would be a pain as my bindings are application wide.

Everything works fine when I put " event.preventDefault(); " at line 5001 before " if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { "

I don't know if it has any side effect on the scroll (which I do not use) but it allows for the same behavior for selections by keyboard or mouse.

Attachments (0)
Change History (4)

Changed June 17, 2011 01:46PM UTC by JamesCurran comment:1

Oddly, I had intended to post a bug about the exact same problem yesterday. dpalita beat me to it. The basic problem, as I see it, is if you use the keyboard, you get a "selected" event, and then a "blur". If you use the mouse, you get a "blur" and then a "selected". Hence your "blur" handler only knows something was selected if you use the keyboard.

Since a "blur" without selecting causes an "Add New" on my system, this is of great concern. The "preventDefault" workaround dpalita suggests didn't work in my case.

Changed July 13, 2011 12:50PM UTC by scottgonzalez comment:2

#7545 is a duplicate of this ticket.

Changed November 30, 2011 04:20PM UTC by scottgonzalez comment:3

resolution: → duplicate
status: newclosed

Changed November 30, 2011 04:20PM UTC by scottgonzalez comment:4

Duplicate of #7550.