File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/cdk/overlay/dispatchers Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ export class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
67
67
68
68
/** Click event listener that will be attached to the body propagate phase. */
69
69
private _clickListener = ( event : MouseEvent ) => {
70
+ // Get the target through the `composedPath` if possible to account for shadow DOM.
71
+ const target = event . composedPath ? event . composedPath ( ) [ 0 ] : event . target ;
70
72
const overlays = this . _attachedOverlays ;
71
73
72
74
// Dispatch the mouse event to the top overlay which has subscribers to its mouse events.
@@ -81,7 +83,7 @@ export class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
81
83
82
84
const config = overlayRef . getConfig ( ) ;
83
85
const excludeElements = [ ...config . excludeFromOutsideClick ! , overlayRef . overlayElement ] ;
84
- const isInsideClick : boolean = excludeElements . some ( e => e . contains ( event . target as Node ) ) ;
86
+ const isInsideClick : boolean = excludeElements . some ( e => e . contains ( target ) ) ;
85
87
86
88
// If it is inside click just break - we should do nothing
87
89
// If it is outside click dispatch the mouse event, and proceed with the next overlay
You can’t perform that action at this time.
0 commit comments