* Subscribe to the overlays outside pointer events stream and handle closing out the stack if a * click occurs outside the menus.
()
| 323 | * click occurs outside the menus. |
| 324 | */ |
| 325 | private _subscribeToOutsideClicks() { |
| 326 | if (this.overlayRef) { |
| 327 | this.overlayRef |
| 328 | .outsidePointerEvents() |
| 329 | .pipe(takeUntil(this.stopOutsideClicksListener)) |
| 330 | .subscribe(event => { |
| 331 | const target = _getEventTarget(event) as Element; |
| 332 | const element = this._elementRef.nativeElement; |
| 333 | |
| 334 | if (target !== element && !element.contains(target)) { |
| 335 | if (!this.isElementInsideMenuStack(target)) { |
| 336 | this.menuStack.closeAll(); |
| 337 | } else { |
| 338 | this._closeSiblingTriggers(); |
| 339 | } |
| 340 | } |
| 341 | }); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | /** Subscribe to the MenuStack hasFocus events. */ |
| 346 | private _subscribeToMenuStackHasFocus() { |
no test coverage detected