`getByRole('insertion')` and `getByRole('deletion')` do not match semantic `<del>` and `<ins>` tags
@testing-library/domversion: 9.3.4@testing-libraray/reactversion: 14.2.1- Testing Framework and version:
jest27.5.1 - DOM Environment:
jsdom16.7.0
Relevant code or config:
What you did:
Marking up insertions and deletions using the semantic <ins> and <del> tags and creating assertions to getByRole those semantic elements
What happened:
getByRole('insertion') and getByRole('deletion') throw an error that no accessible roles were found.
Reproduction:
https://github.com/rdwoodring/react-testing-library-ins-del
Problem description:
According to the W3C documentation linked by the testing library docs, <del> and <ins> should have implicit roles of deletion and insertion, respectively. When adding the role explicitly (which is expressly not recommended in the very same W3C documentation), the elements are found correctly.
Suggested solution:
Hi @rdwoodring, thanks for opening this one :)
Any chance you can test this against our alpha release? (can be installed using npm install @testing-library/dom@alpha). We've updated the underlying package (aria-query) there. We're still running some tests and I didn't get a chance to push it forwards to a release but having someone else testing that release will really help us.
Thanks!
@MatanBobi I just tested it out using npm overrides to force @testing-library/react to use the alpha of @testing-library/dom and it seems that the issue is, indeed, resolved there. Any idea when that'll be released and when it will trickle down into @testing-library/react?
And anything I can do to help?
Thanks
Thanks @rdwoodring, appreciate you taking the time to test it. Currently, I'm out of capacity to test it in some of my projects, that's why we're holding it back. If you can run it on your entire project to see that you're not experiencing any regression it will be extremely valuable. Thanks again!
Ok, let me see what I can do.
v10.0.0 is now live with this update, and looks like react-testing-library v15.0.0 will drop soon, see https://github.com/testing-library/react-testing-library/pull/1295 (and then overrides won't be needed).
Thanks @jlp-craigmorten :)