Skip to content

Commit

Permalink
Merge pull request #15025 from TaneliTuomola/issue-15024
Browse files Browse the repository at this point in the history
fix #15024 table filter row aria-labels
  • Loading branch information
cetincakiroglu authored Mar 19, 2024
2 parents af54f03 + 1900d91 commit 1d69273
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4953,6 +4953,7 @@ export class ReorderableRow implements AfterViewInit {
class="p-fluid"
[type]="type"
[field]="field"
[ariaLabel]="ariaLabel"
[filterConstraint]="dt.filters[field]"
[filterTemplate]="filterTemplate"
[placeholder]="placeholder"
Expand Down Expand Up @@ -5211,6 +5212,11 @@ export class ColumnFilter implements AfterContentInit {
* @group Props
*/
@Input() showButtons: boolean = true;
/**
* Defines the aria-label of the form element.
* @group Props
*/
@Input() ariaLabel: string | undefined;

@ViewChild('icon') icon: Nullable<ElementRef>;

Expand Down Expand Up @@ -5745,7 +5751,7 @@ export class ColumnFilter implements AfterContentInit {
</ng-container>
<ng-template #builtInElement>
<ng-container [ngSwitch]="type">
<input *ngSwitchCase="'text'" type="text" pInputText [value]="filterConstraint?.value" (input)="onModelChange($event.target.value)" (keydown.enter)="onTextInputEnterKeyDown($event)" [attr.placeholder]="placeholder" />
<input *ngSwitchCase="'text'" type="text" [ariaLabel]="ariaLabel" pInputText [value]="filterConstraint?.value" (input)="onModelChange($event.target.value)" (keydown.enter)="onTextInputEnterKeyDown($event)" [attr.placeholder]="placeholder" />
<p-inputNumber
*ngSwitchCase="'numeric'"
[ngModel]="filterConstraint?.value"
Expand All @@ -5754,6 +5760,7 @@ export class ColumnFilter implements AfterContentInit {
[showButtons]="showButtons"
[minFractionDigits]="minFractionDigits"
[maxFractionDigits]="maxFractionDigits"
[ariaLabel]="ariaLabel"
[prefix]="prefix"
[suffix]="suffix"
[placeholder]="placeholder"
Expand All @@ -5764,8 +5771,8 @@ export class ColumnFilter implements AfterContentInit {
[currencyDisplay]="currencyDisplay"
[useGrouping]="useGrouping"
></p-inputNumber>
<p-triStateCheckbox *ngSwitchCase="'boolean'" [ngModel]="filterConstraint?.value" (ngModelChange)="onModelChange($event)"></p-triStateCheckbox>
<p-calendar *ngSwitchCase="'date'" [placeholder]="placeholder" [ngModel]="filterConstraint?.value" (ngModelChange)="onModelChange($event)" appendTo="body"></p-calendar>
<p-triStateCheckbox [ariaLabel]="ariaLabel" *ngSwitchCase="'boolean'" [ngModel]="filterConstraint?.value" (ngModelChange)="onModelChange($event)"></p-triStateCheckbox>
<p-calendar [ariaLabel]="ariaLabel" *ngSwitchCase="'date'" [placeholder]="placeholder" [ngModel]="filterConstraint?.value" (ngModelChange)="onModelChange($event)" appendTo="body"></p-calendar>
</ng-container>
</ng-template>
`,
Expand Down Expand Up @@ -5803,6 +5810,8 @@ export class ColumnFilterFormElement implements OnInit {

@Input() useGrouping: boolean = true;

@Input() ariaLabel: string | undefined;

get showButtons(): boolean {
return this.colFilter.showButtons;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/doc/table/filterrowdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ import { CustomerService } from '../../service/customerservice';
</tr>
<tr>
<th>
<p-columnFilter type="text" field="name"></p-columnFilter>
<p-columnFilter type="text" field="name" ariaLabel="Filter Name"></p-columnFilter>
</th>
<th>
<p-columnFilter type="text" field="country.name"></p-columnFilter>
<p-columnFilter type="text" field="country.name" ariaLabel="Filter Country"></p-columnFilter>
</th>
<th>
<p-columnFilter field="representative" matchMode="in" [showMenu]="false">
Expand Down

0 comments on commit 1d69273

Please sign in to comment.