diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 346db11b307..4d73648c27f 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -5631,9 +5631,13 @@ export class ColumnFilter implements AfterContentInit { 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(); - } + dialogElements.forEach((dialogElement) => { + const appendToBodyExists = dialogElement.querySelector('[appendto="body"]') !== null + + if (this.overlayVisible && this.isOutsideClicked(event) && !appendToBodyExists && (targetIsColumnFilterMenuButton || dialogElements?.length <= 1)) { + this.hide(); + } + }); this.selfClick = false; });