Skip to content

Commit 6eb7493

Browse files
author
Ebbe Brandstrup
committed
Fixed Tab key not respecting opts.selectOnBlur
1 parent dfeb6d4 commit 6eb7493

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

select2.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,10 @@ the specific language governing permissions and limitations under the Apache Lic
19071907
killEvent(e);
19081908
return;
19091909
case KEY.TAB:
1910-
this.selectHighlighted({noFocus: true});
1910+
// if selectOnBlur == true, select the currently highlighted option
1911+
if (this.opts.selectOnBlur) {
1912+
this.selectHighlighted({noFocus: true});
1913+
}
19111914
return;
19121915
case KEY.ESC:
19131916
this.cancel(e);
@@ -2487,7 +2490,10 @@ the specific language governing permissions and limitations under the Apache Lic
24872490
killEvent(e);
24882491
return;
24892492
case KEY.TAB:
2490-
this.selectHighlighted({noFocus:true});
2493+
// if selectOnBlur == true, select the currently highlighted option
2494+
if (this.opts.selectOnBlur) {
2495+
this.selectHighlighted({noFocus:true});
2496+
}
24912497
this.close();
24922498
return;
24932499
case KEY.ESC:

0 commit comments

Comments
 (0)