Skip to content

Commit f4282e0

Browse files
authored
Merge pull request #7517 from plotly/scroll-violation-fix
fix wheel event handler Violation in Chromium by setting passive: true
2 parents 9ae845a + 4054a61 commit f4282e0

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/lib/events.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ var Events = {
6060
};
6161

6262
/*
63-
* Add a dummy event handler for 'wheel' event for Safari
64-
* to enable mouse wheel zoom.
65-
* https://github.com/d3/d3/issues/3035
66-
* https://github.com/plotly/plotly.js/issues/7452
67-
*/
63+
* Add a dummy event handler for 'wheel' event for Safari
64+
* to enable mouse wheel zoom.
65+
* https://github.com/d3/d3/issues/3035
66+
* https://github.com/plotly/plotly.js/issues/7452
67+
*
68+
* We set {passive: true} for better performance
69+
* and to avoid a Violation warning in Chromium.
70+
* https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
71+
* https://github.com/plotly/plotly.js/issues/7516
72+
*/
6873
if(typeof plotObj.addEventListener === 'function') {
69-
plotObj.addEventListener("wheel", () => {});
74+
plotObj.addEventListener("wheel", () => {}, { passive: true });
7075
}
7176

7277
return plotObj;

0 commit comments

Comments
 (0)