Skip to content

fix wheel event handler Violation in Chromium by setting passive: true #7517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ var Events = {
};

/*
* Add a dummy event handler for 'wheel' event for Safari
* to enable mouse wheel zoom.
* https://github.com/d3/d3/issues/3035
* https://github.com/plotly/plotly.js/issues/7452
*/
* Add a dummy event handler for 'wheel' event for Safari
* to enable mouse wheel zoom.
* https://github.com/d3/d3/issues/3035
* https://github.com/plotly/plotly.js/issues/7452
*
* We set {passive: true} for better performance
* and to avoid a Violation warning in Chromium.
* https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
* https://github.com/plotly/plotly.js/issues/7516
*/
if(typeof plotObj.addEventListener === 'function') {
plotObj.addEventListener("wheel", () => {});
plotObj.addEventListener("wheel", () => {}, { passive: true });
}

return plotObj;
Expand Down