Skip to content

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

Closed
@rdwoodring

Description

@rdwoodring
  • @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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions