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 182
182
ctrl . activate = function ( initSearchValue , avoidReset ) {
183
183
if ( ! ctrl . disabled && ! ctrl . open ) {
184
184
if ( ! avoidReset ) _resetSearchInput ( ) ;
185
+ ctrl . focusser . prop ( 'disabled' , true ) ; //Will reactivate it on .close()
185
186
ctrl . open = true ;
186
187
ctrl . activeMatchIndex = - 1 ;
187
188
319
320
} ;
320
321
321
322
// When the user clicks on an item inside the dropdown
322
- ctrl . select = function ( item ) {
323
+ ctrl . select = function ( item , skipFocusser ) {
323
324
324
325
if ( item === undefined || ! item . _uiSelectChoiceDisabled ) {
325
326
var locals = { } ;
336
337
} else {
337
338
ctrl . selected = item ;
338
339
}
339
- ctrl . close ( ) ;
340
+ ctrl . close ( skipFocusser ) ;
340
341
}
341
342
} ;
342
343
343
344
// Closes the dropdown
344
- ctrl . close = function ( ) {
345
- if ( ctrl . open ) {
345
+ ctrl . close = function ( skipFocusser ) {
346
+ if ( ! ctrl . open ) return ;
346
347
_resetSearchInput ( ) ;
347
348
ctrl . open = false ;
349
+ if ( ! ctrl . multiple ) {
348
350
$timeout ( function ( ) {
349
- ctrl . focusser [ 0 ] . focus ( ) ;
351
+ ctrl . focusser . prop ( 'disabled' , false ) ;
352
+ if ( ! skipFocusser ) ctrl . focusser [ 0 ] . focus ( ) ;
350
353
} , 0 , false ) ;
351
354
}
352
355
} ;
403
406
else if ( ctrl . activeIndex > 0 ) { ctrl . activeIndex -- ; }
404
407
break ;
405
408
case KEY . TAB :
406
- //TODO: Que hacemos en modo multiple?
407
- if ( ! ctrl . multiple ) ctrl . select ( ctrl . items [ ctrl . activeIndex ] ) ;
409
+ if ( ! ctrl . multiple || ctrl . open ) ctrl . select ( ctrl . items [ ctrl . activeIndex ] , true ) ;
408
410
break ;
409
411
case KEY . ENTER :
410
412
if ( ctrl . open ) {
You can’t perform that action at this time.
0 commit comments