ソースを参照

Merge pull request #1555 from ebbe-brandstrup/master

Fixed Tab key not respecting opts.selectOnBlur
Igor Vaynberg 11 年 前
コミット
001c9abb34
1 ファイル変更8 行追加2 行削除
  1. 8 2
      select2.js

+ 8 - 2
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: