-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Image and combobox are not being detected by the getByRole. #512
Comments
I am also seeing this issue when using react testing library, since it depends on aria-query. Currently have to fix aria-query version to 5.1.3., and prevent it from updating to 5.2.1 |
R.E. the
REF: https://www.w3.org/TR/html-aria/#docconformance It is therefore the W3C Recommendation that an Uncertain what the changes in https://github.com/A11yance/aria-query/pull/447/files#diff-643c621e212a40fbb0863ef49bc5bdfa2a95a406f7bdf2afb4ec3ebd0d16dabf have done to this effect 🤔 |
See also conversation in testing-library/dom-testing-library#1235 |
Test cases (with import "react";
import "@testing-library/jest-dom";
import { render, screen } from "@testing-library/react";
describe("W3C Recommendations: https://www.w3.org/TR/html-aria/#docconformance", () => {
test("img with no alt has an img role", async () => {
render(<img src="#" />);
expect(await screen.queryByRole("img")).not.toBeNull(); // Passes ✅
});
test("img with an empty alt has a presentation role", async () => {
render(<img src="#" alt="" />);
expect(await screen.queryByRole("presentation")).not.toBeNull(); // Passes ✅
});
test("img with a non-empty alt has an img role", async () => {
render(<img src="#" alt="Alternative Text" />);
expect(await screen.queryByRole("img")).not.toBeNull(); // Fails ❌
});
}); |
@jlp-craigmorten thank you for this report. I'll look into the issue this weekend and get a fix up. |
Describe the bug
Image tagged element and combobox are not being detected by the getByRole query.
Aria-query previous working version - 5.1.3
Aria-query upgraded version version - 5.2.1
<img src="/rcore/static/media/AccessDenied_Icon.db53e967.svg" alt="" class="sc-lmJFLr hLGeOl sc-jRBLiq ghkJEk" id="">
Previously before the 'aria-query' upgrade, getByRole query will detect the above element. But after the upgrade this query is not able to detect the above element.
We have many test cases that are breaking due to above issue . This behavior is happening since v5.2.1. Please fix the issue above issue.
The text was updated successfully, but these errors were encountered: