Skip to content
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

getByRole('insertion') and getByRole('deletion') do not match semantic <del> and <ins> tags #1288

Closed
rdwoodring opened this issue Feb 8, 2024 · 6 comments

Comments

@rdwoodring
Copy link

  • @testing-library/dom version: 9.3.4
  • @testing-libraray/react version: 14.2.1
  • Testing Framework and version: jest 27.5.1
  • DOM Environment: jsdom 16.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:

@MatanBobi
Copy link
Member

MatanBobi commented Feb 8, 2024

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!

@rdwoodring
Copy link
Author

@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

@MatanBobi
Copy link
Member

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!

@rdwoodring
Copy link
Author

Ok, let me see what I can do.

@jlp-craigmorten
Copy link
Contributor

v10.0.0 is now live with this update, and looks like react-testing-library v15.0.0 will drop soon, see testing-library/react-testing-library#1295 (and then overrides won't be needed).

@MatanBobi
Copy link
Member

Thanks @jlp-craigmorten :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants