Skip to content

Commit 22ba931

Browse files
committed
Menu: skip over elements that aren't menu items.
Fixes #5188 - Refactor menu rendering for more customizing.
1 parent 65d8fa2 commit 22ba931

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

demos/autocomplete/categories.html

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,6 @@
1919
}
2020
</style>
2121
<script type="text/javascript">
22-
$.extend( $.ui.menu.prototype, {
23-
next: function() {
24-
this.move("next", ".ui-menu-item:first");
25-
},
26-
27-
previous: function() {
28-
this.move("prev", ".ui-menu-item:last");
29-
},
30-
31-
move: function(direction, edge) {
32-
if (!this.active) {
33-
this.activate(this.element.children(edge));
34-
return;
35-
}
36-
var next = this.active[direction + "All"]('.ui-menu-item').eq( 0 );
37-
if (next.length) {
38-
this.activate(next);
39-
} else {
40-
this.activate(this.element.children(edge));
41-
}
42-
}
43-
});
44-
4522
$.widget("custom.catcomplete", $.ui.autocomplete, {
4623
_renderMenu: function( ul, items ) {
4724
var self = this,

ui/jquery.ui.autocomplete.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,11 @@ $.widget("ui.menu", {
391391
},
392392

393393
next: function(event) {
394-
this.move("next", "li:first", event);
394+
this.move("next", ".ui-menu-item:first", event);
395395
},
396396

397397
previous: function(event) {
398-
this.move("prev", "li:last", event);
398+
this.move("prev", ".ui-menu-item:last", event);
399399
},
400400

401401
first: function() {
@@ -411,7 +411,7 @@ $.widget("ui.menu", {
411411
this.activate(event, this.element.children(edge));
412412
return;
413413
}
414-
var next = this.active[direction]();
414+
var next = this.active[direction + "All"](".ui-menu-item").eq(0);
415415
if (next.length) {
416416
this.activate(event, next);
417417
} else {

0 commit comments

Comments
 (0)