Skip to content

Commit

Permalink
Menu: pass the original event to the select callback.
Browse files Browse the repository at this point in the history
Fixes #5343 - Add option to allow form submission when option is chosen.
  • Loading branch information
scottgonzalez committed Mar 20, 2010
1 parent c61bd8e commit 1ddd4f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ui/jquery.ui.autocomplete.js
Expand Up @@ -60,7 +60,7 @@ $.widget( "ui.autocomplete", {
if ( !self.menu.active ) {
return;
}
self.menu.select();
self.menu.select( event );
break;
case keyCode.ESCAPE:
self.element.val( self.term );
Expand Down Expand Up @@ -334,13 +334,13 @@ $.widget("ui.menu", {
role: "listbox",
"aria-activedescendant": "ui-active-menuitem"
})
.click(function(e) {
if ( !$( e.target ).closest( ".ui-menu-item" ).length ) {
.click(function( event ) {
if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
return;
}
// temporary
e.preventDefault();
self.select();
event.preventDefault();
self.select( event );
});
this.refresh();
},
Expand Down Expand Up @@ -481,8 +481,8 @@ $.widget("ui.menu", {
return this.element.height() < this.element.attr("scrollHeight");
},

select: function() {
this._trigger("selected", null, { item: this.active });
select: function( event ) {
this._trigger("selected", event, { item: this.active });
}
});

Expand Down

0 comments on commit 1ddd4f5

Please sign in to comment.