ux icon indicating copy to clipboard operation
ux copied to clipboard

Allow all custom events to bubble

Open weaverryan opened this issue 3 years ago • 0 comments

I just had a conversation with someone that wanted to render a chart, but then, on click of a button, change the chart. The solution for this should be to wrap a controller around the chart and the button. Then, inside that custom controller, listen to chartjs:connect event. However, that even doesn't bubble, so it doesn't work.

We should allow all events to bubble (I can't think of a downside). And then re-work the Chart.js custom controller example to show off this use-case.

Also, in the docs, we should probably use bind(this) so that in users' methods, this remains the controller instance:

    connect() {
+        this.element.addEventListener('chartjs:pre-connect', this._onPreConnect.bind(this));
-        this.element.addEventListener('chartjs:pre-connect', this._onPreConnect);
    }

weaverryan avatar Jan 14 '22 20:01 weaverryan