esnet / react-timeseries-charts

Declarative and modular timeseries charting components for React
http://software.es.net/react-timeseries-charts
Other
859 stars 283 forks source link

Feature: Allowing event propagation on chart click events #414

Open joshuaball opened 4 years ago

joshuaball commented 4 years ago

Because event propagation was being killed on the click event of each chart, this was not allowing parent DOM elements to receive the click event. Clicks on the background layers (ChartContainer, ChartRow, etc) would bubble up fine, but we miss any click events from charts. This PR allows event propagation at the chart level, and the onBackgroundClick property of the ChartContainer still works as intended by scrutinizing the event target of the click event that bubbles up to it and triggering the onBackgroundClick property only when the event target does not come from a chart component.

NOTE: I mocked up a "playground" example for demonstration that will need to be stripped out.