Skip to content

Commit

Permalink
Merge pull request #16221 from primefaces/issue-16219
Browse files Browse the repository at this point in the history
Fixed #16219 - Menu: console.error when selecting a menu item with ke…
  • Loading branch information
cetincakiroglu authored Aug 15, 2024
2 parents 8a0f70b + 9db6b5e commit 7dac62a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,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 7dac62a

Please sign in to comment.