Skip to content

Commit

Permalink
Merge pull request #13754 from rosenthalj/master
Browse files Browse the repository at this point in the history
properly fix issue #13361
  • Loading branch information
cetincakiroglu authored Sep 27, 2023
2 parents ffc8eee + a02b08c commit 0df123d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3338,7 +3338,7 @@ export class SortableColumn implements OnInit, OnDestroy {

@HostListener('click', ['$event'])
onClick(event: MouseEvent) {
if (this.isEnabled()) {
if (this.isEnabled() && !this.isFilterElement(<HTMLElement>event.target)) {
this.updateSortState();
this.dt.sort({
originalEvent: event,
Expand All @@ -3358,6 +3358,13 @@ export class SortableColumn implements OnInit, OnDestroy {
return this.pSortableColumnDisabled !== true;
}

isFilterElement(element: HTMLElement) {
return this.isFilterElementIconOrButton(element) || this.isFilterElementIconOrButton(element?.parentElement?.parentElement);
}
private isFilterElementIconOrButton(element: HTMLElement) {
return DomHandler.hasClass(element, 'pi-filter-icon') || DomHandler.hasClass(element, 'p-column-filter-menu-button');
}

ngOnDestroy() {
if (this.subscription) {
this.subscription.unsubscribe();
Expand Down Expand Up @@ -4777,7 +4784,7 @@ export class ReorderableRow implements AfterViewInit {
aria-haspopup="true"
[attr.aria-expanded]="overlayVisible"
[ngClass]="{ 'p-column-filter-menu-button-open': overlayVisible, 'p-column-filter-menu-button-active': hasFilter() }"
(click)="toggleMenu($event)"
(click)="toggleMenu()"
(keydown)="onToggleButtonKeyDown($event)"
>
<FilterIcon [styleClass]="'pi-filter-icon'" *ngIf="!filterIconTemplate" />
Expand Down Expand Up @@ -5108,9 +5115,8 @@ export class ColumnFilter implements AfterContentInit {
}
}

toggleMenu(event: any) {
toggleMenu() {
this.overlayVisible = !this.overlayVisible;
event.stopPropagation();
}

onToggleButtonKeyDown(event: KeyboardEvent) {
Expand Down

1 comment on commit 0df123d

@vercel
Copy link

@vercel vercel bot commented on 0df123d Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.