onClick handler not fired on children
See original GitHub issue<Link to='/home' onClick={this.onItemClick}>
<i className="fa fa-file"></i>
<span id='works'>Click me - I work!!</span>
<Highlighter search={this.props.query} caseSensitive={false}>
{this.props.name}
</Highlighter>
</Link>
this.onItemClick
is only invoked when clicking on span#works
. However, clicking any of the elements from Highlighter
doesn’t actually propagate the event in any way. I’ve found that it does work when I remove {'key': this.count}
from the children in the array.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
ReactJS: onClick handler not firing when placed on a child ...
I have a question regarding placing onClick event listeners in child components. As you can see from the code sample below, I have...
Read more >ourstytems Child Container onClick event trigger the parent ...
Hi,. In a Mobile application Screen I have a Parent Container & Child Container under it. For both Container I added the onClick...
Read more >Element: click event - Web APIs | MDN
click fires after both the mousedown and mouseup events have fired, in that order. Syntax. Use the event name in methods like addEventListener() ......
Read more >JavaScript: Preventing Parent Event When Child Event Is ...
When the onClick is triggered in my child element, I want to stop the propagation to my parent element's onClick event.
Read more >Event Bubbling and Event Catching in JavaScript and React
Once an inner child element's event is called, all elements above/below it will also be called (bubbling/capturing). To stop this from happening ...
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
As a workaround, you can set
pointer-events: none
on the highlighter component.There’s a PR open https://github.com/helior/react-highlighter/pull/46 to fix it, however, it usually takes a rather long time to get anything merged.