Skip to content

Commit 806f887

Browse files
committed
Keyboard Navigation Improvements
ALT-L will now jump from the filter to the first item in the list, saving a few keys. SHIFT-TAB in the list of checkboxes will bring focus to the last item in the header, usually the close button so keyboard navigation can continue. This is instead of closing the menu. Got rid of that 'ui-front' addition. It should never have been committed.
1 parent 4957cfc commit 806f887

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/jquery.multiselect.filter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
type: "search"
6363
}).css({
6464
width: (/\d/.test(opts.width) ? opts.width + 'px' : null)
65-
}).addClass("ui-front").bind({
65+
}).bind({
6666
keydown: function(e) {
6767
// prevent the enter key from submitting the form / closing the widget
6868
if(e.which === 13) {
@@ -81,6 +81,9 @@
8181
case 85:
8282
elem.multiselect('instance').uncheckAll();
8383
break;
84+
case 76:
85+
elem.multiselect('instance').labels.first().trigger("mouseenter");
86+
break;
8487
}
8588
}
8689
},

src/jquery.multiselect.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@
373373
e.preventDefault();
374374
switch(e.which) {
375375
case 9: // tab
376+
if(e.shiftKey) {
377+
self.menu.find(".ui-state-hover").removeClass("ui-state-hover");
378+
self.header.find("li").last().find("a").focus();
379+
} else {
380+
self.close();
381+
}
382+
break;
376383
case 27: // esc
377384
self.close();
378385
break;
@@ -383,6 +390,7 @@
383390
self._traverse(e.which, this);
384391
break;
385392
case 13: // enter
393+
case 32:
386394
$(this).find('input')[0].click();
387395
break;
388396
case 65:

0 commit comments

Comments
 (0)