Let me elaborate on this issue. I have a List component from material-UI, with ListItem set to button=true which makes the entire item act as a button.
Within the ListItem, I have added a FontAwesomeIcon. To hide the button, I set its style to visibility: "hidden" and the Icon to visibility: "visible" so that it remains visible. (perhaps not the best practice, but couldn't think of another way at the moment).
Now, when someone clicks on the ListItem outside the Icon area, the onClick event of the ListItem is triggered - which is expected and good! However, when clicking on the Icon itself, both the onClick events of the "Icon button" and the ListItem are called - while this behavior is expected, it's not desired in my case.
Is there a way to bring the smaller "nested" button to the forefront of the parent button so that only its event is triggered?
If not, is there a way for the parent onClick event to detect whether it was clicked within the Icon area so that different functions can be called based on the click location?
I am open to any other suggestions as I am new to react and web development in general, and I want to learn and implement best practices solutions.
Thank you in advance :)