From 98f37a54611136ffc937ad40270d60b733e80456 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Thu, 14 Nov 2024 23:06:54 +0200 Subject: [PATCH] fix: explicit passive: false for wheel events to prevent warnings on console --- src/handlers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/handlers.js b/src/handlers.js index 2dfec1c5..f9c195c2 100644 --- a/src/handlers.js +++ b/src/handlers.js @@ -22,7 +22,10 @@ function addHandler(chart, target, type, handler) { removeHandler(chart, type); handlers[type] = (event) => handler(chart, event, options); handlers[type].target = target; - target.addEventListener(type, handlers[type]); + + // `passive: false` for wheel events, to prevent chrome warnings. Use default value for other events. + const passive = type === 'wheel' ? false : undefined; + target.addEventListener(type, handlers[type], {passive}); } export function mouseMove(chart, event) {