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 +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 11801180 } ;
11811181
11821182 function onDocumentClick ( e ) {
1183+ if ( ! $select . open ) return ; //Skip it if dropdown is close
1184+
11831185 var contains = false ;
11841186
11851187 if ( window . jQuery ) {
11911193 }
11921194
11931195 if ( ! contains && ! $select . clickTriggeredSelect ) {
1194- var targetScope = angular . element ( e . target ) . scope ( ) ;
1195- $select . close ( targetScope && targetScope . $select && targetScope . $select !== $select ) ; // Skip focusser if the target is another select
1196+ //Will lose focus only with certain targets
1197+ var focusableControls = [ 'input' , 'button' , 'textarea' ] ;
1198+ var targetScope = angular . element ( e . target ) . scope ( ) ; //To check if target is other ui-select
1199+ var skipFocusser = targetScope && targetScope . $select && targetScope . $select !== $select ; //To check if target is other ui-select
1200+ if ( ! skipFocusser ) skipFocusser = ~ focusableControls . indexOf ( e . target . tagName . toLowerCase ( ) ) ; //Check if target is input, button or textarea
1201+ $select . close ( skipFocusser ) ;
11961202 scope . $digest ( ) ;
11971203 }
11981204 $select . clickTriggeredSelect = false ;
You can’t perform that action at this time.
0 commit comments