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 184184 ctrl . activate = function ( initSearchValue , avoidReset ) {
185185 if ( ! ctrl . disabled && ! ctrl . open ) {
186186 if ( ! avoidReset ) _resetSearchInput ( ) ;
187+ ctrl . focusser . prop ( 'disabled' , true ) ; //Will reactivate it on .close()
187188 ctrl . open = true ;
188189 ctrl . activeMatchIndex = - 1 ;
189190
321322 } ;
322323
323324 // When the user clicks on an item inside the dropdown
324- ctrl . select = function ( item ) {
325+ ctrl . select = function ( item , skipFocusser ) {
325326
326327 if ( item === undefined || ! item . _uiSelectChoiceDisabled ) {
327328 var locals = { } ;
338339 } else {
339340 ctrl . selected = item ;
340341 }
341- ctrl . close ( ) ;
342+ ctrl . close ( skipFocusser ) ;
342343 }
343344 } ;
344345
345346 // Closes the dropdown
346- ctrl . close = function ( ) {
347- if ( ctrl . open ) {
347+ ctrl . close = function ( skipFocusser ) {
348+ if ( ! ctrl . open ) return ;
348349 _resetSearchInput ( ) ;
349350 ctrl . open = false ;
351+ if ( ! ctrl . multiple ) {
350352 $timeout ( function ( ) {
351- ctrl . focusser [ 0 ] . focus ( ) ;
353+ ctrl . focusser . prop ( 'disabled' , false ) ;
354+ if ( ! skipFocusser ) ctrl . focusser [ 0 ] . focus ( ) ;
352355 } , 0 , false ) ;
353356 }
354357 } ;
405408 else if ( ctrl . activeIndex > 0 ) { ctrl . activeIndex -- ; }
406409 break ;
407410 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 ) ;
410412 break ;
411413 case KEY . ENTER :
412414 if ( ctrl . open ) {
You can’t perform that action at this time.
0 commit comments