Skip to content

Commit

Permalink
Fix #16298 (#16593)
Browse files Browse the repository at this point in the history
  • Loading branch information
kapnak authored Nov 18, 2024
1 parent 8dd15af commit e96e41c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,9 @@ export class Menu implements OnDestroy {
const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';

this.documentClickListener = this.renderer.listen(documentTarget, 'click', (event) => {
const isOutsideContainer = this.containerViewChild?.nativeElement && !this.containerViewChild?.nativeElement.contains(event.target);
const isOutsideTarget = !(this.target && (this.target === event.target || this.target.contains(event.target)));
const eventTarget = event.composed ? event.composedPath()[0] : event.target;
const isOutsideContainer = this.containerViewChild?.nativeElement && !this.containerViewChild?.nativeElement.contains(eventTarget);
const isOutsideTarget = !(this.target && (this.target === eventTarget || this.target.contains(eventTarget)));
if (!this.popup && isOutsideContainer && isOutsideTarget) {
this.onListBlur(event);
}
Expand Down

0 comments on commit e96e41c

Please sign in to comment.