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
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11931193 } ;
11941194
11951195 function onDocumentClick ( e ) {
1196+ if ( ! $select . open ) return ; //Skip it if dropdown is close
1197+
11961198 var contains = false ;
11971199
11981200 if ( window . jQuery ) {
12041206 }
12051207
12061208 if ( ! contains && ! $select . clickTriggeredSelect ) {
1207- $select . close ( angular . element ( e . target ) . closest ( '.ui-select-container.open' ) . length > 0 ) ; // Skip focusser if the target is another select
1209+ //Will lose focus only with certain targets
1210+ var focusableControls = [ 'input' , 'button' , 'textarea' ] ;
1211+ var targetScope = angular . element ( e . target ) . scope ( ) ; //To check if target is other ui-select
1212+ var skipFocusser = targetScope && targetScope . $select && targetScope . $select !== $select ; //To check if target is other ui-select
1213+ if ( ! skipFocusser ) skipFocusser = ~ focusableControls . indexOf ( e . target . tagName . toLowerCase ( ) ) ; //Check if target is input, button or textarea
1214+ $select . close ( skipFocusser ) ;
12081215 scope . $digest ( ) ;
12091216 }
12101217 $select . clickTriggeredSelect = false ;
You can’t perform that action at this time.
0 commit comments