-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Select] Aria error flagged by WAVE and W3C #20296
Comments
Thanks for opening this issue. Does WAVE provide more information beyond "Broken ARIA Reference Errors"? |
Broken ARIA referenceWhat It MeansAn aria-labelledby or aria-describedby reference exists, but the target for the reference does not exist. Why It MattersARIA labels and descriptions will not be presented if the element referenced does not exist in the page. How to Fix ItEnsure the element referenced in the aria-labelledby or aria-describedby attribute value is present within the page and presents a proper label or description. The Algorithm... in EnglishAn element has an aria-labelledby or aria-describedby value that does not match the id attribute value of another element in the page. Standards and Guidelines1.3.1 Info and Relationships (Level A) |
@mfsjr Thanks for the report. While this issue focuses on the reported errors. WAVE also reports less important alerts, I will take care of it in batch (e.g. broken anchor link). |
@eps1lon If you would prefer working on it, I can leave it to you. Let me know, I wouldn't want to distract you from the prop-types -> TypeScript migration of the descriptions :D. |
@oliviertassinari No perfectly fine. That's why I assigned it to you and unsubscribed. But you had to mention me again 😛 |
Thank you @oliviertassinari , @eps1lon for such quick response! |
I could narrow the problem down to #17892 (comment). @mfsjr What do you think of the following patch? Do you want to work on a pull request? :) diff --git a/packages/material-ui/src/Select/Select.test.js b/packages/material-ui/src/Select/Select.test.js
index afe173849..bd9986b90 100644
--- a/packages/material-ui/src/Select/Select.test.js
+++ b/packages/material-ui/src/Select/Select.test.js
@@ -409,7 +409,7 @@ describe('<Select />', () => {
const { getByRole } = render(<Select value="" />);
// TODO what is the accessible name actually?
- expect(getByRole('button')).to.have.attribute('aria-labelledby', ' ');
+ expect(getByRole('button')).to.not.have.attribute('aria-labelledby');
});
it('is labelled by itself when it has a name', () => {
@@ -417,7 +417,7 @@ describe('<Select />', () => {
expect(getByRole('button')).to.have.attribute(
'aria-labelledby',
- ` ${getByRole('button').getAttribute('id')}`,
+ getByRole('button').getAttribute('id'),
);
});
diff --git a/packages/material-ui/src/Select/SelectInput.js b/packages/material-ui/src/Select/SelectInput.js
index 6ace9e2ba..9af95915e 100644
--- a/packages/material-ui/src/Select/SelectInput.js
+++ b/packages/material-ui/src/Select/SelectInput.js
@@ -320,7 +320,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
tabIndex={tabIndex}
role="button"
aria-expanded={open ? 'true' : undefined}
- aria-labelledby={`${labelId || ''} ${buttonId || ''}`}
+ aria-labelledby={[labelId, buttonId].filter(Boolean).join(' ') || undefined}
aria-haspopup="listbox"
onKeyDown={handleKeyDown}
onMouseDown={disabled || readOnly ? null : handleMouseDown} It solves:
|
Hi @oliviertassinari , looking... lerna ERR! yarn run typescript exited 1 in 'docs' |
@mfsjr Did you try to have the CI run the tests? Also, did you pull the latest changes and run yarn at the root of the repository? |
@oliviertassinari The docs mention CI running tests upon submitting the PR only, so no, I did not, I was just trying to make sure my environment could run the tests on my fork of master. I ran "yarn install" which took a few minutes and succeeded. Git log shows the most recent:
|
@oliviertassinari Looks like the test failure is originating in material-table, not material-ui. I guess that is because material-table is in a material-ui demo, and somehow gets evaluated during testing. When I fix it there, 'yarn test' succeeds. |
@mfsjr It's good to know, thanks for sharing. So you have an issue with your installation steps. We force an older version of material-table. |
PR submitted: #20356 |
Thanks very much @oliviertassinari and @eps1lon ! |
WAVE errors in tables, in TablePagination/TableFooter
Current Behavior 😯
WAVE identifies 3 "Broken ARIA Reference Errors" associated with three demos
Expected Behavior 🤔
No WAVE errors
No WAVE errors
Steps to Reproduce 🕹
Given above
Steps:
Context 🔦
Your Environment 🌎
OSX Mojave, Chrome v80, WAVE v3.0.4
The text was updated successfully, but these errors were encountered: