Delegated events do not bubble
See original GitHub issueFirst off, thanks for writing this library! I’ve been using MobX in combination with React for quite some time and always felt like there must be a more reactive and finer grained approach to updating the DOM with an observer library like MobX. I’m really happy I found your libraries as it looks like they bring it all together in a very nice way. Congrats on your work and the new ideas!
I noticed that setting event handler props that result in delegated events do not bubble, which I assume is not by design. Here is an example:
function MyComponent() {
function onClick(e) {
console.log(e)
}
return (
<div onClick={onClick}>
Parent
<div onClick={onClick}>
Child
</div>
</div>
)
}
Clicking on the child div prints to the console only once even though stopPropagation
is not called. Using the onclick
instead of the onClick
prop works as expected and clicking on the child div results in two log entries in the console.
I would have expected the delegated events to bubble as long as stopPropagation
is not called.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Ok this should behave as expected now in the new version dom-expressions 0.7.10. Please confirm that it works for you.
Wow this was fast! I can confirm that it now works as expected for me.