Skip to content

Commit 4094c1c

Browse files
committed
fix tab-on-select transfers focus to next element. fixes select2#898. fixes select2#1045
1 parent 9c1caa6 commit 4094c1c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

select2.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ the specific language governing permissions and limitations under the Apache Lic
12851285
this.results.empty();
12861286

12871287

1288-
this.clearSearch();
1288+
this.clearSearch();
12891289
this.search.removeClass("select2-active");
12901290
this.opts.element.trigger($.Event("select2-close"));
12911291
},
@@ -1729,7 +1729,7 @@ the specific language governing permissions and limitations under the Apache Lic
17291729
if (!this.opened()) return;
17301730
this.parent.close.apply(this, arguments);
17311731
this.focusser.removeAttr("disabled");
1732-
focus(this.focusser);
1732+
this.focusser.focus();
17331733
},
17341734

17351735
// single
@@ -1791,11 +1791,13 @@ the specific language governing permissions and limitations under the Apache Lic
17911791
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
17921792
killEvent(e);
17931793
return;
1794-
case KEY.TAB:
17951794
case KEY.ENTER:
17961795
this.selectHighlighted();
17971796
killEvent(e);
17981797
return;
1798+
case KEY.TAB:
1799+
this.selectHighlighted({noFocus: true});
1800+
return;
17991801
case KEY.ESC:
18001802
this.cancel(e);
18011803
killEvent(e);
@@ -2328,10 +2330,12 @@ the specific language governing permissions and limitations under the Apache Lic
23282330
killEvent(e);
23292331
return;
23302332
case KEY.ENTER:
2331-
case KEY.TAB:
23322333
this.selectHighlighted();
23332334
killEvent(e);
23342335
return;
2336+
case KEY.TAB:
2337+
this.selectHighlighted({noFocus:true});
2338+
return;
23352339
case KEY.ESC:
23362340
this.cancel(e);
23372341
killEvent(e);

0 commit comments

Comments
 (0)