Skip to content

Commit

Permalink
Merge pull request #16021 from ymg2006/filterDialog-outsideclick
Browse files Browse the repository at this point in the history
fixes #16020 Table: column-filter outside click does not close when it is inside a dialog component
  • Loading branch information
cetincakiroglu authored Jul 25, 2024
2 parents 850ce31 + 33def4e commit 489d966
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5788,9 +5788,10 @@ export class ColumnFilter implements AfterContentInit {
const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';

this.documentClickListener = this.renderer.listen(documentTarget, 'mousedown', (event) => {
const dialogElements = document.querySelectorAll('[role="dialog"]');
let isDateDialog = false;
document.querySelectorAll('[role="dialog"]').forEach(d => { if(DomHandler.hasClass(d, 'p-datepicker')) isDateDialog = true; });
const targetIsColumnFilterMenuButton = event.target.closest('.p-column-filter-menu-button');
if (this.overlayVisible && this.isOutsideClicked(event) && (targetIsColumnFilterMenuButton || dialogElements?.length <= 1)) {
if (this.overlayVisible && this.isOutsideClicked(event) && (targetIsColumnFilterMenuButton || !isDateDialog)) {
this.hide();
}

Expand Down

0 comments on commit 489d966

Please sign in to comment.