Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #15024 table filter row aria-labels #15025

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4945,6 +4945,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 @@ -5203,6 +5204,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 @@ -5735,7 +5741,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 @@ -5744,6 +5750,7 @@ export class ColumnFilter implements AfterContentInit {
[showButtons]="showButtons"
[minFractionDigits]="minFractionDigits"
[maxFractionDigits]="maxFractionDigits"
[ariaLabel]="ariaLabel"
[prefix]="prefix"
[suffix]="suffix"
[placeholder]="placeholder"
Expand All @@ -5754,8 +5761,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 @@ -5793,6 +5800,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
Loading