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 1193
1193
} ;
1194
1194
1195
1195
function onDocumentClick ( e ) {
1196
+ if ( ! $select . open ) return ; //Skip it if dropdown is close
1197
+
1196
1198
var contains = false ;
1197
1199
1198
1200
if ( window . jQuery ) {
1204
1206
}
1205
1207
1206
1208
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 ) ;
1208
1215
scope . $digest ( ) ;
1209
1216
}
1210
1217
$select . clickTriggeredSelect = false ;
You can’t perform that action at this time.
0 commit comments