Skip to content

Commit

Permalink
Fixed #15233 | Refactor condition for outsideClick
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Apr 18, 2024
1 parent c4f794c commit e23fd69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5612,6 +5612,7 @@ export class ColumnFilter implements AfterContentInit {

isOutsideClicked(event: any): boolean {
return !(
DomHandler.hasClass(this.overlay?.nextElementSibling, 'p-overlay') ||
this.overlay?.isSameNode(event.target) ||
this.overlay?.contains(event.target) ||
this.icon?.nativeElement.isSameNode(event.target) ||
Expand All @@ -5630,7 +5631,6 @@ export class ColumnFilter implements AfterContentInit {
this.documentClickListener = this.renderer.listen(documentTarget, 'mousedown', (event) => {
const dialogElements = document.querySelectorAll('[role="dialog"]');
const targetIsColumnFilterMenuButton = event.target.closest('.p-column-filter-menu-button');

if (this.overlayVisible && this.isOutsideClicked(event) && (targetIsColumnFilterMenuButton || dialogElements?.length <= 1)) {
this.hide();
}
Expand Down

0 comments on commit e23fd69

Please sign in to comment.