File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 37
37
class ={{ concat " margin-top-px-0 upf-power-select__dropdown " this.dropdownAddressableClass }}
38
38
id ={{ this.portalId }}
39
39
{{ on " click" this.noop }}
40
- {{ on-click-outside this.onClickOutside }}
40
+ {{ on-click-outside this.onClickOutside useCapture = @ captureClickOutside }}
41
41
>
42
42
<:option as |item|>
43
43
{{ yield item to =" option-item" }}
61
61
class ={{ concat " margin-top-px-0 upf-power-select__dropdown " this.dropdownAddressableClass }}
62
62
id ={{ this.portalId }}
63
63
{{ on " click" this.noop }}
64
- {{ on-click-outside this.onClickOutside }}
64
+ {{ on-click-outside this.onClickOutside useCapture = @ captureClickOutside }}
65
65
>
66
66
<:option as |item|>
67
67
{{ yield item to =" option-item" }}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { isTesting } from '@embroider/macros';
6
6
7
7
export interface BaseDropdownArgs {
8
8
focusOnOpen ?: boolean ;
9
+ captureClickOutside ?: boolean ;
9
10
}
10
11
11
12
export default class OSSBaseDropdown < T extends BaseDropdownArgs > extends Component < T > {
@@ -40,7 +41,9 @@ export default class OSSBaseDropdown<T extends BaseDropdownArgs> extends Compone
40
41
41
42
@action
42
43
onClickOutside ( _ : HTMLElement , event : MouseEvent ) : void {
43
- event . stopPropagation ( ) ;
44
+ if ( ! this . args . captureClickOutside || this . container . contains ( event . target as HTMLElement ) ) {
45
+ event . stopPropagation ( ) ;
46
+ }
44
47
this . closeDropdown ( ) ;
45
48
}
46
49
Original file line number Diff line number Diff line change 32
32
@enableKeyboard ={{ true }}
33
33
id ={{ this.portalId }}
34
34
class ={{ concat " margin-top-px-0 oss-select-container__dropdown " this.dropdownAddressableClass }}
35
- {{ on-click-outside this.onClickOutside }}
35
+ {{ on-click-outside this.onClickOutside useCapture = @ captureClickOutside }}
36
36
{{ on " click" this.noop }}
37
37
>
38
38
<:option as |item|>
You can’t perform that action at this time.
0 commit comments