JSS Cannot target child to perform some basic css operations
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
One should be able to create something like: List item has a child which is hidden by default. When the List item gets hovered, the child gets displayed.
The component in question is this:
<ListItemSecondaryAction className={classes.actionsContainer}>
Current Behavior
Trying to change a style of a child on parent hover. It doesn’t seem to work. I might as well be using it wrong though…
Should I do something to enable this behavior? As I understood the documentation the jss-nested
should already be available?
Your Environment
Tech | Version |
---|---|
Material-UI | 1.0.0-beta.41 |
React | 16.3.0 |
browser | |
etc |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
JSS Cannot target child to perform some basic css operations
Basically, it works when I hover the checkboxItem , but not the actionsContainer . I'm not sure how to debug if the code...
Read more >How to apply style to parent if it has child with CSS?
We know how to apply styles to the child elements if a parent class has one. But if we want to apply a...
Read more >How do I prevent drag on a child, but allow drag on the parent?
If you want to truly cancel out the drag and make it unnoticeable to parent drag handlers, you need to both preventDefault and...
Read more >touch-action - CSS: Cascading Style Sheets - MDN Web Docs
The touch-action CSS property sets how an element's region can be manipulated by a touchscreen user (for example, by zooming features built ...
Read more >Overriding CSS properties of third-party components in Angular
However, the element that you want to target using the CSS selector is not a child, but just a descendant of the cars-page...
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
@oliviertassinari I understand, no problem.
By the way, the problem was that the
<ListItem>
classes added withclassName
actually get applied to the element that gets generated under the<li>
item, but not the<li>
itself. For that I’ve usedContainerProps={{ className: classes.listItem }}
and declared the hover under thelistItems
style.Sorry for taking your time for this trivial problem. I hope this might help someone else who encounters the same problem.
Cheers 😉
@mnemanja, your solution worked for me and saved me many hours and much frustration! Thank you for sharing!