-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(material-experimental/mdc-paginator): target page size label with aria-labelledby
#23172
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
Conversation
Kicked off a presubmit |
bc47590
to
319daff
Compare
319daff
to
1e38251
Compare
1e38251
to
482e969
Compare
… `aria-labelledby` Fixes a screenrader bug on the mdc-paginator for the page size combobox ("Items per page: [combo]"). On Firefox, JAWS and NVDA do not read the value of the combobox, and only read the label. This happens because the mdc-paginator explicitly sets an `aria-label` on the `mdc-select` for the page size label. This causes the mdc-select to not apply an aria-labelledby, which would reference the value of the combobox. This leaves us with only relying on inner text to read the value of the combobox and not having an aria-label or labelledby to read it. This PR corrects that behavior by refering the existing page size label using `aria-labelledby`, and not setting an `aria-label`. The mdc-select will append a reference to the value of the combobox to the aria-lablledby. This gives us a list of ids of both the label and the value of the combobox. That way we can be sure that all screenreaders (including Windows screenreaders) will read both the value and label of the combobox.
482e969
to
f223301
Compare
@zarend were you able to test this fix on Windows and confirm it addresses the issues? |
Yes, I validated that this fixes the bug on Windows Firefox using the mdc-paginator demo in the dev-app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -66,6 +68,10 @@ export class MatPaginator extends _MatPaginatorBase<MatPaginatorDefaultOptions> | |||
/** If set, styles the "page size" form field with the designated style. */ | |||
_formFieldAppearance?: MatFormFieldAppearance; | |||
|
|||
/** ID for the DOM node containing the pagiators's items per page label. */ | |||
readonly _pageSizeLabelId = `mat-paginator-page-size-label-${nextUniqueId++}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might shorten this to something like mat-pgntr-x
just to shave off a few bytes
aria-labelledby
… `aria-labelledby` (#23172) Fixes a screenrader bug on the mdc-paginator for the page size combobox ("Items per page: [combo]"). On Firefox, JAWS and NVDA do not read the value of the combobox, and only read the label. This happens because the mdc-paginator explicitly sets an `aria-label` on the `mdc-select` for the page size label. This causes the mdc-select to not apply an aria-labelledby, which would reference the value of the combobox. This leaves us with only relying on inner text to read the value of the combobox and not having an aria-label or labelledby to read it. This PR corrects that behavior by refering the existing page size label using `aria-labelledby`, and not setting an `aria-label`. The mdc-select will append a reference to the value of the combobox to the aria-lablledby. This gives us a list of ids of both the label and the value of the combobox. That way we can be sure that all screenreaders (including Windows screenreaders) will read both the value and label of the combobox. (cherry picked from commit 85a7e45)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
See commit message for description.
Original bug is filed internally at http://b/188218083
From the bug report:
ENVIRONMENT
OS | Browser | Assistive Technology
Windows version 20H2, Firefox version 88.0.1 (64-bit)
JAWS 2021 Version 2021.2102.34 ILM,
NVDA version 2020.4
PREREQUISITES
Turn on screen reader
STEPS TO REPRODUCE
Open Mozilla Firefox
Navigate to https://xap-gallery.googleplex.com/embed/a11y/mdc-paginator
Tab to the number of items combo box.
Notice the announcement.
EXPECTED RESULT(S)
the value of the combo box should be announced by the screen reader.
ACTUAL RESULT(S)
The screen reader announces the role of the combo box, but not the value . e.g. “Items per page: Combo box, To change the selection use the Arrow keys”.
ADDITIONAL NOTE(S)
This issue is only reproducible in Mozilla Firefox.
VIDEO/SCREENSHOT(S)
https://drive.google.com/file/d/1HRDaA8bXKXlduobTUmWUraAUd7v1tZ5h/view?usp=sharing&resourcekey=0-rNDyr76TRjgPc9mEQH-exg