Hitting Tab selects current highlighted option
While navigating through native selects using the keyboard, one can start typing the text of the desired option to select it, then hit the Tab key to move to the next element with the desired option remaining selected. This doesn't work with Chosen currently (the correct option is highlighted, but it is not selected once the Tab key is hit.) Now the current highlighted option in a non-multiple Chosen select is selected when the Tab key is hit. Resolves #104.
This commit is contained in:
parent
91734e94ee
commit
208370bd0d
|
@ -650,6 +650,9 @@
|
||||||
this.backstroke_length = this.search_field.val().length;
|
this.backstroke_length = this.search_field.val().length;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
if (this.results_showing && !this.is_multiple) {
|
||||||
|
this.result_select(evt);
|
||||||
|
}
|
||||||
this.mouse_on_container = false;
|
this.mouse_on_container = false;
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
|
|
2
chosen/chosen.jquery.min.js
vendored
2
chosen/chosen.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -653,6 +653,9 @@
|
||||||
case 8:
|
case 8:
|
||||||
return this.backstroke_length = this.search_field.value.length;
|
return this.backstroke_length = this.search_field.value.length;
|
||||||
case 9:
|
case 9:
|
||||||
|
if (this.results_showing && !this.is_multiple) {
|
||||||
|
this.result_select(evt);
|
||||||
|
}
|
||||||
return this.mouse_on_container = false;
|
return this.mouse_on_container = false;
|
||||||
case 13:
|
case 13:
|
||||||
return evt.preventDefault();
|
return evt.preventDefault();
|
||||||
|
|
2
chosen/chosen.proto.min.js
vendored
2
chosen/chosen.proto.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -539,6 +539,7 @@ class Chosen
|
||||||
@backstroke_length = this.search_field.val().length
|
@backstroke_length = this.search_field.val().length
|
||||||
break
|
break
|
||||||
when 9
|
when 9
|
||||||
|
this.result_select(evt) if this.results_showing and not @is_multiple
|
||||||
@mouse_on_container = false
|
@mouse_on_container = false
|
||||||
break
|
break
|
||||||
when 13
|
when 13
|
||||||
|
|
|
@ -539,6 +539,7 @@ class Chosen
|
||||||
when 8
|
when 8
|
||||||
@backstroke_length = this.search_field.value.length
|
@backstroke_length = this.search_field.value.length
|
||||||
when 9
|
when 9
|
||||||
|
this.result_select(evt) if this.results_showing and not @is_multiple
|
||||||
@mouse_on_container = false
|
@mouse_on_container = false
|
||||||
when 13
|
when 13
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
|
|
Loading…
Reference in a new issue