Skip to content

Commit 299fa57

Browse files
committed
fix(material/paginator): add role="group" to host
In testing `<mat-paginator>` with VoiceOver, I found that the interaction was much nicer when the paginator controls were semantically grouped with `role="group"`. This change adds the role and updates the documentation to explicitly instruct users to apply a meaningful label.
1 parent bf99037 commit 299fa57

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/material-experimental/mdc-paginator/paginator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const MAT_PAGINATOR_DEFAULT_OPTIONS =
5757
inputs: ['disabled'],
5858
host: {
5959
'class': 'mat-mdc-paginator',
60+
'role': 'group',
6061
},
6162
changeDetection: ChangeDetectionStrategy.OnPush,
6263
encapsulation: ViewEncapsulation.None,

src/material/paginator/paginator.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ This will allow you to change the following:
2626
3. The tooltip messages on the navigation buttons.
2727

2828
### Accessibility
29-
The `aria-label`s for next page, previous page, first page and last page buttons can be set in `MatPaginatorIntl`.
29+
The paginator uses `role="group"` to semantically group its child controls. You must add an
30+
`aria-label` or `aria-labelledby` attribute to `<mat-paginator>` with a label that describes
31+
the content controlled by the pagination control.
32+
33+
You can set the `aria-label` attributes for the button and select controls within the paginator in
34+
`MatPaginatorIntl`.

src/material/paginator/paginator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ export abstract class _MatPaginatorBase<O extends {
357357
inputs: ['disabled'],
358358
host: {
359359
'class': 'mat-paginator',
360+
'role': 'group',
360361
},
361362
changeDetection: ChangeDetectionStrategy.OnPush,
362363
encapsulation: ViewEncapsulation.None,

0 commit comments

Comments
 (0)