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 1180
1180
} ;
1181
1181
1182
1182
function onDocumentClick ( e ) {
1183
+ if ( ! $select . open ) return ; //Skip it if dropdown is close
1184
+
1183
1185
var contains = false ;
1184
1186
1185
1187
if ( window . jQuery ) {
1191
1193
}
1192
1194
1193
1195
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 ) ;
1196
1202
scope . $digest ( ) ;
1197
1203
}
1198
1204
$select . clickTriggeredSelect = false ;
You can’t perform that action at this time.
0 commit comments