Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcetin01140 committed Aug 13, 2024
1 parent 73b78a8 commit 9db6b5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ export class Menu implements OnDestroy {
this.onShow.emit({});
this.appendOverlay();
this.alignOverlay();
this.bindDocumentClickListener();
this.bindDocumentResizeListener();
this.bindScrollListener();
DomHandler.focus(this.listViewChild.nativeElement);
Expand Down Expand Up @@ -722,7 +723,7 @@ 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 isOutsideContainer = this.containerViewChild?.nativeElement && !this.containerViewChild?.nativeElement.contains(event.target);
const isOutsideTarget = !(this.target && (this.target === event.target || this.target.contains(event.target)));
if (!this.popup && isOutsideContainer && isOutsideTarget) {
this.onListBlur(event);
Expand Down

0 comments on commit 9db6b5e

Please sign in to comment.