From a31a5ab787261506803e156571c7df306cc01018 Mon Sep 17 00:00:00 2001 From: Jonathon Hill Date: Mon, 5 Dec 2016 14:50:53 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20propagate=20clicks=20that=20are?= =?UTF-8?q?=20handled=20internally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents the chart `options.onClick` handler from being called if the user clicks on a legend item, for instance. Calling `event.stopImmediatePropagation()` in the legend item click handler would not fix the issue since it is always called after the chart `options.onClick` handler. --- src/core/core.controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 9e4984a9af6..7f3c6618373 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -818,8 +818,9 @@ module.exports = function(Chart) { me._bufferedRender = true; me._bufferedRequest = null; - var changed = me.handleEvent(e); + var changed = legend && legend.handleEvent(e); changed |= tooltip && tooltip.handleEvent(e); + if (!changed) changed = me.handleEvent(e); plugins.notify(me, 'afterEvent', [e]);