This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 184
184
ctrl . activate = function ( initSearchValue , avoidReset ) {
185
185
if ( ! ctrl . disabled && ! ctrl . open ) {
186
186
if ( ! avoidReset ) _resetSearchInput ( ) ;
187
+ ctrl . focusser . prop ( 'disabled' , true ) ; //Will reactivate it on .close()
187
188
ctrl . open = true ;
188
189
ctrl . activeMatchIndex = - 1 ;
189
190
321
322
} ;
322
323
323
324
// When the user clicks on an item inside the dropdown
324
- ctrl . select = function ( item ) {
325
+ ctrl . select = function ( item , skipFocusser ) {
325
326
326
327
if ( item === undefined || ! item . _uiSelectChoiceDisabled ) {
327
328
var locals = { } ;
338
339
} else {
339
340
ctrl . selected = item ;
340
341
}
341
- ctrl . close ( ) ;
342
+ ctrl . close ( skipFocusser ) ;
342
343
}
343
344
} ;
344
345
345
346
// Closes the dropdown
346
- ctrl . close = function ( ) {
347
- if ( ctrl . open ) {
347
+ ctrl . close = function ( skipFocusser ) {
348
+ if ( ! ctrl . open ) return ;
348
349
_resetSearchInput ( ) ;
349
350
ctrl . open = false ;
351
+ if ( ! ctrl . multiple ) {
350
352
$timeout ( function ( ) {
351
- ctrl . focusser [ 0 ] . focus ( ) ;
353
+ ctrl . focusser . prop ( 'disabled' , false ) ;
354
+ if ( ! skipFocusser ) ctrl . focusser [ 0 ] . focus ( ) ;
352
355
} , 0 , false ) ;
353
356
}
354
357
} ;
405
408
else if ( ctrl . activeIndex > 0 ) { ctrl . activeIndex -- ; }
406
409
break ;
407
410
case KEY . TAB :
408
- //TODO: Que hacemos en modo multiple?
409
- if ( ! ctrl . multiple ) ctrl . select ( ctrl . items [ ctrl . activeIndex ] ) ;
411
+ if ( ! ctrl . multiple || ctrl . open ) ctrl . select ( ctrl . items [ ctrl . activeIndex ] , true ) ;
410
412
break ;
411
413
case KEY . ENTER :
412
414
if ( ctrl . open ) {
You can’t perform that action at this time.
0 commit comments