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 182182 ctrl . activate = function ( initSearchValue , avoidReset ) {
183183 if ( ! ctrl . disabled && ! ctrl . open ) {
184184 if ( ! avoidReset ) _resetSearchInput ( ) ;
185+ ctrl . focusser . prop ( 'disabled' , true ) ; //Will reactivate it on .close()
185186 ctrl . open = true ;
186187 ctrl . activeMatchIndex = - 1 ;
187188
319320 } ;
320321
321322 // When the user clicks on an item inside the dropdown
322- ctrl . select = function ( item ) {
323+ ctrl . select = function ( item , skipFocusser ) {
323324
324325 if ( item === undefined || ! item . _uiSelectChoiceDisabled ) {
325326 var locals = { } ;
336337 } else {
337338 ctrl . selected = item ;
338339 }
339- ctrl . close ( ) ;
340+ ctrl . close ( skipFocusser ) ;
340341 }
341342 } ;
342343
343344 // Closes the dropdown
344- ctrl . close = function ( ) {
345- if ( ctrl . open ) {
345+ ctrl . close = function ( skipFocusser ) {
346+ if ( ! ctrl . open ) return ;
346347 _resetSearchInput ( ) ;
347348 ctrl . open = false ;
349+ if ( ! ctrl . multiple ) {
348350 $timeout ( function ( ) {
349- ctrl . focusser [ 0 ] . focus ( ) ;
351+ ctrl . focusser . prop ( 'disabled' , false ) ;
352+ if ( ! skipFocusser ) ctrl . focusser [ 0 ] . focus ( ) ;
350353 } , 0 , false ) ;
351354 }
352355 } ;
403406 else if ( ctrl . activeIndex > 0 ) { ctrl . activeIndex -- ; }
404407 break ;
405408 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 ) ;
408410 break ;
409411 case KEY . ENTER :
410412 if ( ctrl . open ) {
You can’t perform that action at this time.
0 commit comments