Skip to content

Commit

Permalink
Fixed #14271
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Dec 6, 2023
1 parent e6cbd3b commit 259f124
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/components/treetable/treetable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { BlockableUI, FilterMetadata, FilterService, PrimeTemplate, ScrollerOptions, SharedModule, SortMeta, TreeNode, TreeTableNode } from 'primeng/api';
import { BlockableUI, FilterMetadata, FilterService, PrimeNGConfig, PrimeTemplate, ScrollerOptions, SharedModule, SortMeta, TreeNode, TreeTableNode } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { ArrowDownIcon } from 'primeng/icons/arrowdown';
import { ArrowUpIcon } from 'primeng/icons/arrowup';
Expand Down Expand Up @@ -3510,6 +3510,7 @@ export class TTRow {
[style.marginLeft]="rowNode.level * 16 + 'px'"
[attr.data-pc-section]="'rowtoggler'"
[attr.data-pc-group-section]="'rowactionbutton'"
[attr.aria-label]="toggleButtonAriaLabel"
>
<ng-container *ngIf="!tt.togglerIconTemplate">
<ChevronDownIcon *ngIf="rowNode.node.expanded" [attr.aria-hidden]="true" />
Expand All @@ -3526,7 +3527,11 @@ export class TTRow {
export class TreeTableToggler {
@Input() rowNode: any;

constructor(public tt: TreeTable) {}
constructor(public tt: TreeTable, private config: PrimeNGConfig) {}

get toggleButtonAriaLabel() {
return this.config.translation ? (this.rowNode.expanded ? this.config.translation.aria.collapseRow : this.config.translation.aria.expandRow) : undefined;
}

onClick(event: Event) {
this.rowNode.node.expanded = !this.rowNode.node.expanded;
Expand Down

0 comments on commit 259f124

Please sign in to comment.