[v2] Pass down data attributes to container/nested elements
See original GitHub issue- What’s your use case?
I want easily select react-select
using data-testid
attribute selector for e2e
test using cypress
- What interface do you have in mind?
Please pass down data attributes to the, at least, container, or come up with more advanced API for such use cases for easy selection of internal elements using CSS selectors.
So we can easily type, click etc. Some additions to the docs “how to test” will be a nice thing to have too.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:24
- Comments:8 (1 by maintainers)
Top Results From Across the Web
How to properly pass custom data attribute props to child ...
Dashes are not allowed in variable names. So, you have to use quotes ''. const Example = (props) => <div>{props['data-name']}</div> ReactDOM.render( ...
Read more >Using data attributes - Learn web development | MDN
This article is adapted from Using data attributes in JavaScript and CSS on hacks.mozilla.org. Custom attributes are also supported in SVG 2; ...
Read more >A Complete Guide to Data Attributes | CSS-Tricks
Everything you ever wanted to know about data attributes in HTML, CSS, and JavaScript.
Read more >How to Access Custom Attributes from Event Object in React
Adding a custom attribute to an element is a great way to pass in additional data as meta properties. They can be accessed...
Read more >Enhance Your Lightning Web Components with Data Attributes
Data attributes give you the ability to specify custom attributes on any elements with the HTML of your Lightning Web Component.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gwyneplaine it definitely would be nice to have a way to use
data-
attributes rather than class names, as recommended in the cypress docs.Is this project dead? 😃 I understand that there is hundreds of Issues and PRs etc. But, dunno, maybe it’s time to give control over this project to some fellow OSS contributors that will be happy to review and clean up the mess at least a little bit? 😃