From 06c3e7f57c10d39bdac9ff022d8e135d232bd130 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:25:44 -0400 Subject: [PATCH 1/8] add dummy 'wheel' event handler to enable scroll zoom on safari --- src/plot_api/plot_api.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 730428f675f..9eabea81b87 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -64,6 +64,12 @@ function _doPlot(gd, data, layout, config) { // Events.init is idempotent and bails early if gd has already been init'd Events.init(gd); + // Add 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 + d3.select(gd).on('wheel', function() {}); + if(Lib.isPlainObject(data)) { var obj = data; data = obj.data; From e6618c678a90fa0fcda1bb959b6fe2d98d53a6e8 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 17 Jul 2025 18:21:38 -0400 Subject: [PATCH 2/8] move dummy scroll listener to Events.init() --- src/lib/events.js | 10 ++++++++++ src/plot_api/plot_api.js | 6 ------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lib/events.js b/src/lib/events.js index 364400bf8d1..6202ece21ef 100644 --- a/src/lib/events.js +++ b/src/lib/events.js @@ -59,6 +59,16 @@ var Events = { internalEv.emit(event, data); }; + /* + * 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 + */ + if(typeof plotObj.addEventListener === 'function') { + plotObj.addEventListener("wheel", () => {}); + } + return plotObj; }, diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 9eabea81b87..730428f675f 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -64,12 +64,6 @@ function _doPlot(gd, data, layout, config) { // Events.init is idempotent and bails early if gd has already been init'd Events.init(gd); - // Add 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 - d3.select(gd).on('wheel', function() {}); - if(Lib.isPlainObject(data)) { var obj = data; data = obj.data; From 3ebf3bd9a6be3fe653f530b649e835b829cc137a Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 18 Jul 2025 13:06:41 -0400 Subject: [PATCH 3/8] use conditional chaining instead of if statement --- src/lib/events.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/events.js b/src/lib/events.js index 6202ece21ef..c95f869a04e 100644 --- a/src/lib/events.js +++ b/src/lib/events.js @@ -65,9 +65,7 @@ var Events = { * https://github.com/d3/d3/issues/3035 * https://github.com/plotly/plotly.js/issues/7452 */ - if(typeof plotObj.addEventListener === 'function') { - plotObj.addEventListener("wheel", () => {}); - } + plotObj?.addEventListener?.("wheel", () => {}); return plotObj; }, From b142a3def9e49d822ff706ac52aba1b3d480f2cf Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 18 Jul 2025 13:09:54 -0400 Subject: [PATCH 4/8] use newer acorn version for bundling, to support newer JS syntax --- package-lock.json | 28 ++++++++++++++++------------ package.json | 7 ++++++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 581d3d5924a..e4fe74f20b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1891,10 +1891,11 @@ } }, "node_modules/acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", + "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -4450,9 +4451,10 @@ } }, "node_modules/falafel/node_modules/acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -10015,10 +10017,11 @@ } }, "node_modules/terser-webpack-plugin/node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", "peer": true, "bin": { "acorn": "bin/acorn" @@ -10748,10 +10751,11 @@ } }, "node_modules/webpack/node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", "peer": true, "bin": { "acorn": "bin/acorn" diff --git a/package.json b/package.json index d37c4f530b4..092d5f6af42 100644 --- a/package.json +++ b/package.json @@ -178,5 +178,10 @@ "transform-loader": "^0.2.4", "true-case-path": "^2.2.1", "virtual-webgl": "^1.0.6" + }, + "overrides": { + "falafel": { + "acorn": "^8.1.1" + } } -} +} \ No newline at end of file From 4a5437466d7e3d99dae9beb1ebaf57bb8e45115c Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 18 Jul 2025 13:59:20 -0400 Subject: [PATCH 5/8] add draftlog --- draftlogs/7474_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/7474_fix.md diff --git a/draftlogs/7474_fix.md b/draftlogs/7474_fix.md new file mode 100644 index 00000000000..5a09e640946 --- /dev/null +++ b/draftlogs/7474_fix.md @@ -0,0 +1 @@ + - Fix scroll wheel zoom for choropleth maps in Safari [#7474](https://github.com/plotly/plotly.js/pull/7474) From b5deb4d68fe7962ef17f2257fc6a2d507bee65bb Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 18 Jul 2025 14:15:22 -0400 Subject: [PATCH 6/8] Update draftlogs/7474_fix.md Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com> --- draftlogs/7474_fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/draftlogs/7474_fix.md b/draftlogs/7474_fix.md index 5a09e640946..7c8e11859ee 100644 --- a/draftlogs/7474_fix.md +++ b/draftlogs/7474_fix.md @@ -1 +1 @@ - - Fix scroll wheel zoom for choropleth maps in Safari [#7474](https://github.com/plotly/plotly.js/pull/7474) +- Fix scroll wheel zoom for geo subplots in Safari [#7474](https://github.com/plotly/plotly.js/pull/7474) From 76c855d4713973faf705176e1e8defb0d4d384c8 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 18 Jul 2025 15:32:06 -0400 Subject: [PATCH 7/8] return to if statement for checking existence of addEventListener --- src/lib/events.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/events.js b/src/lib/events.js index c95f869a04e..6202ece21ef 100644 --- a/src/lib/events.js +++ b/src/lib/events.js @@ -65,7 +65,9 @@ var Events = { * https://github.com/d3/d3/issues/3035 * https://github.com/plotly/plotly.js/issues/7452 */ - plotObj?.addEventListener?.("wheel", () => {}); + if(typeof plotObj.addEventListener === 'function') { + plotObj.addEventListener("wheel", () => {}); + } return plotObj; }, From 72c2269fc6849a27f127e151a9d01eaf2aed3475 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 18 Jul 2025 15:32:32 -0400 Subject: [PATCH 8/8] Revert "use newer acorn version for bundling, to support newer JS syntax" This reverts commit b142a3def9e49d822ff706ac52aba1b3d480f2cf. --- package-lock.json | 28 ++++++++++++---------------- package.json | 7 +------ 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index e4fe74f20b5..581d3d5924a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1891,11 +1891,10 @@ } }, "node_modules/acorn": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", - "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true, - "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -4451,10 +4450,9 @@ } }, "node_modules/falafel/node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "license": "MIT", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "bin": { "acorn": "bin/acorn" }, @@ -10017,11 +10015,10 @@ } }, "node_modules/terser-webpack-plugin/node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, - "license": "MIT", "peer": true, "bin": { "acorn": "bin/acorn" @@ -10751,11 +10748,10 @@ } }, "node_modules/webpack/node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, - "license": "MIT", "peer": true, "bin": { "acorn": "bin/acorn" diff --git a/package.json b/package.json index 092d5f6af42..d37c4f530b4 100644 --- a/package.json +++ b/package.json @@ -178,10 +178,5 @@ "transform-loader": "^0.2.4", "true-case-path": "^2.2.1", "virtual-webgl": "^1.0.6" - }, - "overrides": { - "falafel": { - "acorn": "^8.1.1" - } } -} \ No newline at end of file +}