Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7484 closed enhancement (duplicate)

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.

Change History (4)

comment:1 Changed 8 years ago by JamesCurran

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.

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

#7545 is a duplicate of this ticket.

comment:3 Changed 8 years ago by Scott González

Resolution: duplicate
Status: newclosed

comment:4 Changed 8 years ago by Scott González

Duplicate of #7550.

Note: See TracTickets for help on using tickets.