Skip to content

Commit 0adc6f5

Browse files
committed
Menu: Remove need to pass an event for next(), previous(), focus().
1 parent ba1776a commit 0adc6f5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ui/jquery.ui.autocomplete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ $.widget( "ui.autocomplete", {
225225
var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
226226
if ( false !== this._trigger( "focus", event, { item: item } ) ) {
227227
// use value to match what will end up in the input, if it was a key event
228-
if ( /^key/.test(event.originalEvent.type) ) {
228+
if ( event.originalEvent && /^key/.test(event.originalEvent.type) ) {
229229
this._value( item.value );
230230
}
231231
} else {
@@ -468,7 +468,7 @@ $.widget( "ui.autocomplete", {
468468
}, this.options.position ));
469469

470470
if ( this.options.autoFocus ) {
471-
this.menu.next( new $.Event("mouseover") );
471+
this.menu.next();
472472
}
473473
},
474474

ui/jquery.ui.menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ $.widget( "ui.menu", {
340340
// highlight active parent menu item, if any
341341
this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" );
342342

343-
if ( event.type === "keydown" ) {
343+
if ( event && event.type === "keydown" ) {
344344
this._close();
345345
} else {
346346
this.timer = this._delay(function() {

0 commit comments

Comments
 (0)