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

SVGIcon should render 'data-testid' (and all data- attributes) #1880

Closed
Josh68 opened this issue Jun 1, 2022 · 4 comments
Closed

SVGIcon should render 'data-testid' (and all data- attributes) #1880

Josh68 opened this issue Jun 1, 2022 · 4 comments
Labels
Status: In JIRA Indicates that this item is also tracked in Jira

Comments

@Josh68
Copy link
Contributor

Josh68 commented Jun 1, 2022

Describe the bug
SVGs should render data- attributes, according to spec (see also). SVGIcon (and therefore all other DS Icons), will not render these attributes.

There are bugs in Testing Library such that getByRole queries on images that are aria-hidden will not work with the name option (accessible name, referencing the SVG's title content), so using a data-testid attribute is the best fallback (the only one that works without resorting to plain CSS queries). Reference bug report

To Reproduce
Steps to reproduce the behavior:

  1. Import any Icon or use the SVGIcon component with any valid SVG content
  2. Pass in a data-testid prop. This is not flagged by TS, because it's valid
  3. View the rendered SVG, which will have no data-testid attribute
  4. Try with any basic HTML Element in JSX, such as a div
  5. data-testid is rendered (as is any data- attribute)

Expected behavior
data- attributes are rendered

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [OSX 12.4]
  • Browser [Chrome]
  • Version [latest]

Smartphone (please complete the following information):
N/A

Additional context
Add any other context about the problem here.

@scheul93 scheul93 added the Status: In JIRA Indicates that this item is also tracked in Jira label Jun 1, 2022
@scheul93
Copy link
Contributor

scheul93 commented Jun 1, 2022

👋🏻 Hi Josh, thanks for reporting this. I've got it logged in Jira . I'll talk to the team and get this prioritized.

@Josh68
Copy link
Contributor Author

Josh68 commented Jun 1, 2022

👋🏻 Hi Josh, thanks for reporting this. I've got it logged in Jira . I'll talk to the team and get this prioritized.

Thanks, @scheul93!

@scheul93
Copy link
Contributor

scheul93 commented Jun 7, 2022

A fix for this issue was just pushed out in our latest beta release (5.5.0-beta.1). It should be fully released on 6/16

@forrestbaer
Copy link
Contributor

Fix has been fully released in 5.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In JIRA Indicates that this item is also tracked in Jira
Projects
None yet
Development

No branches or pull requests

3 participants