3 ms·
Anything at given coords should receive the event. Whether it makes sense for some other component to receive the event shouldn't be your component's concern. I
by throwaway290 4y ago
Anything at given coords should receive the event. Whether it makes sense for some other component to receive the event shouldn't be your component's concern. It introduces extra coupling and is inconsiderate to other potential users of the component, since you don't know how everything composes in the end. Any parent listening can always inspect which particular child triggered the event and decide whether to act based on that, but you can't conjure an event once it's gone or stopped propagating.
- wruza 4y agoI agree with your reasoning mostly, and can remember situations when I wanted to make an event shoot through a finished element but couldn’t, at least not easily (it wasn’t web). But I think that it wasn’t a great idea either to make it the default and burden a programmer with this decision in each handler. The current way of doing it is pretty error-prone and bloats each handler with checks which are otherwise mostly pointless or tedious. This incentivizes non-experts to omit that part and just cargo in stopPropagation() calls anyway.