File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
<!-- Feel free to put either your handle and/or full name, according to
2
2
your privacy needs -->
3
3
4
+ * Allow the dropdown to reopen on click if it is closed without losing focus
5
+ by closeAfterSelect: true
6
+
7
+ * @fishpercolator *
8
+
9
+
4
10
* Fixed bug making ` clearOptions ` function. Now it doesn't remove already selected options.
5
11
6
12
* (thanks @caseymct - #1079 )*
Original file line number Diff line number Diff line change @@ -362,7 +362,9 @@ $.extend(Selectize.prototype, {
362
362
363
363
// necessary for mobile webkit devices (manual focus triggering
364
364
// is ignored unless invoked within a click event)
365
- if ( ! self . isFocused ) {
365
+ // also necessary to reopen a dropdown that has been closed by
366
+ // closeAfterSelect
367
+ if ( ! self . isFocused || ! self . isOpen ) {
366
368
self . focus ( ) ;
367
369
e . preventDefault ( ) ;
368
370
}
Original file line number Diff line number Diff line change 41
41
} ) ;
42
42
} ) ;
43
43
} ) ;
44
+
45
+ it ( 'should reopen dropdown if clicked after being closed by closeAfterSelect: true' , function ( done ) {
46
+ var test = setup_test ( '<select multiple>' +
47
+ '<option value="a">A</option>' +
48
+ '<option value="b">B</option>' +
49
+ '</select>' , { closeAfterSelect : true } ) ;
50
+
51
+ click ( test . selectize . $control , function ( ) {
52
+ click ( $ ( '[data-value=a]' , test . selectize . $dropdown_content ) , function ( ) {
53
+ click ( test . selectize . $control , function ( ) {
54
+ expect ( test . selectize . isOpen ) . to . be . equal ( true ) ;
55
+ expect ( test . selectize . isFocused ) . to . be . equal ( true ) ;
56
+ done ( ) ;
57
+ } ) ;
58
+ } ) ;
59
+ } ) ;
60
+ } ) ;
44
61
45
62
it ( 'should close and blur dropdown after selection made if closeAfterSelect: true and in single mode' , function ( done ) {
46
63
var test = setup_test ( '<select>' +
You can’t perform that action at this time.
0 commit comments