Skip to content

Commit bb8574f

Browse files
jeripeierSBBwagnermaciel
authored andcommitted
docs(material/paginator): add aria-label to <mat-paginator> usages (#23102)
Under the Accessibility section of the mat-paginator it's written that a `<mat-paginator>` must have an aria-label. But actually none of the found examples does provide an aria-label. https://github.com/angular/components/blob/master/src/material/paginator/paginator.md#accessibility (cherry picked from commit 8482823)
1 parent ef98f3e commit bb8574f

File tree

12 files changed

+25
-15
lines changed

12 files changed

+25
-15
lines changed

src/components-examples/material/paginator/paginator-configurable/paginator-configurable-example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<mat-paginator [length]="length"
1717
[pageSize]="pageSize"
1818
[pageSizeOptions]="pageSizeOptions"
19-
(page)="pageEvent = $event">
19+
(page)="pageEvent = $event"
20+
aria-label="Select page">
2021
</mat-paginator>
2122

2223
<div *ngIf="pageEvent">

src/components-examples/material/paginator/paginator-harness/paginator-harness-example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
[pageSize]="pageSize"
55
[showFirstLastButtons]="showFirstLastButtons"
66
[pageSizeOptions]="pageSizeOptions"
7-
[pageIndex]="pageIndex">
7+
[pageIndex]="pageIndex"
8+
aria-label="Select page">
89
</mat-paginator>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<mat-paginator [length]="200" [pageSizeOptions]="[10, 50, 100]">
1+
<mat-paginator [length]="200" [pageSizeOptions]="[10, 50, 100]" aria-label="Select page">
22
</mat-paginator>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<mat-paginator [length]="100"
22
[pageSize]="10"
3-
[pageSizeOptions]="[5, 10, 25, 100]">
3+
[pageSizeOptions]="[5, 10, 25, 100]"
4+
aria-label="Select page">
45
</mat-paginator>

src/components-examples/material/table/table-http/table-http-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@
4242
</table>
4343
</div>
4444

45-
<mat-paginator [length]="resultsLength" [pageSize]="30"></mat-paginator>
45+
<mat-paginator [length]="resultsLength" [pageSize]="30" aria-label="Select page of GitHub search results"></mat-paginator>
4646
</div>

src/components-examples/material/table/table-overview/table-overview-example.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@
3939
</tr>
4040
</table>
4141

42-
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
42+
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" aria-label="Select page of users"></mat-paginator>
4343
</div>
44-

src/components-examples/material/table/table-pagination/table-pagination-example.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3030
</table>
3131

32-
<mat-paginator [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>
32+
<mat-paginator [pageSizeOptions]="[5, 10, 20]"
33+
showFirstLastButtons
34+
aria-label="Select page of periodic elements">
35+
</mat-paginator>
3336
</div>

src/dev-app/mdc-paginator/mdc-paginator-demo.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<mat-card class="demo-section">
22
<h2>No inputs</h2>
3-
<mat-paginator></mat-paginator>
3+
<mat-paginator aria-label="Select page"></mat-paginator>
44
</mat-card>
55

66
<mat-card class="demo-section">
@@ -34,7 +34,8 @@ <h2>No inputs</h2>
3434
[showFirstLastButtons]="showFirstLastButtons"
3535
[pageSizeOptions]="showPageSizeOptions ? pageSizeOptions : []"
3636
[hidePageSize]="hidePageSize"
37-
[pageIndex]="pageIndex">
37+
[pageIndex]="pageIndex"
38+
aria-label="Select page">
3839
</mat-paginator>
3940

4041
<div> Output event: {{pageEvent | json}} </div>

src/dev-app/paginator/paginator-demo.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<mat-card class="demo-section">
22
<h2>No inputs</h2>
3-
<mat-paginator></mat-paginator>
3+
<mat-paginator aria-label="Select page"></mat-paginator>
44
</mat-card>
55

66
<mat-card class="demo-section">
@@ -31,7 +31,8 @@ <h2>No inputs</h2>
3131
[showFirstLastButtons]="showFirstLastButtons"
3232
[pageSizeOptions]="showPageSizeOptions ? pageSizeOptions : []"
3333
[hidePageSize]="hidePageSize"
34-
[pageIndex]="pageIndex">
34+
[pageIndex]="pageIndex"
35+
aria-label="Select page">
3536
</mat-paginator>
3637

3738
<div> Output event: {{pageEvent | json}} </div>

src/material/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
[length]="dataSource?.data?.length"
2121
[pageIndex]="0"
2222
[pageSize]="10"
23-
[pageSizeOptions]="[5, 10, 20]">
23+
[pageSizeOptions]="[5, 10, 20]"
24+
aria-label="Select page">
2425
</mat-paginator>
2526
</div>

src/universal-app/kitchen-sink-mdc/kitchen-sink-mdc.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ <h2>MDC Tabs</h2>
141141
<h2>MDC Paginator</h2>
142142

143143
<mat-paginator [length]="100"
144-
[pageSizeOptions]="[5, 10, 25, 100]">
144+
[pageSizeOptions]="[5, 10, 25, 100]"
145+
aria-label="Select page">
145146
</mat-paginator>
146147

147148
<h2>MDC Table</h2>

src/universal-app/kitchen-sink/kitchen-sink.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ <h2>Tabs</h2>
236236
<h2>Paginator</h2>
237237

238238
<mat-paginator [length]="100"
239-
[pageSizeOptions]="[5, 10, 25, 100]">
239+
[pageSizeOptions]="[5, 10, 25, 100]"
240+
aria-label="Select page">
240241
</mat-paginator>
241242

242243
<h2>Toolbar</h2>

0 commit comments

Comments
 (0)