From 6eb74930d58f7265839ecf256eedc72ef29d068b Mon Sep 17 00:00:00 2001 From: Ebbe Brandstrup Date: Mon, 22 Jul 2013 09:30:35 +0200 Subject: [PATCH] Fixed Tab key not respecting opts.selectOnBlur --- select2.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 7a6c0c6a..9207009c 100644 --- a/select2.js +++ b/select2.js @@ -1907,7 +1907,10 @@ the specific language governing permissions and limitations under the Apache Lic killEvent(e); return; case KEY.TAB: - this.selectHighlighted({noFocus: true}); + // if selectOnBlur == true, select the currently highlighted option + if (this.opts.selectOnBlur) { + this.selectHighlighted({noFocus: true}); + } return; case KEY.ESC: this.cancel(e); @@ -2487,7 +2490,10 @@ the specific language governing permissions and limitations under the Apache Lic killEvent(e); return; case KEY.TAB: - this.selectHighlighted({noFocus:true}); + // if selectOnBlur == true, select the currently highlighted option + if (this.opts.selectOnBlur) { + this.selectHighlighted({noFocus:true}); + } this.close(); return; case KEY.ESC: