Selectmenu: prevent widget from item looping

This commit is contained in:
Felix Nagel 2013-07-01 22:23:12 +02:00
parent 2c9f5a8c01
commit ff1bb14579

View File

@ -270,6 +270,10 @@ $.widget( "ui.selectmenu", {
// Set focus manually for first or last item // Set focus manually for first or last item
this.menu.menu( "focus", event, this.menuItems[ direction ]() ); this.menu.menu( "focus", event, this.menuItems[ direction ]() );
} else { } else {
if ( direction === "previous" && this.menu.menu( "isFirstItem" ) || direction === "next" && this.menu.menu( "isLastItem" ) ) {
return;
}
// Move to and focus next or prev item // Move to and focus next or prev item
this.menu.menu( direction, event ); this.menu.menu( direction, event );
} }