question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

D3 zoom not working with mousewheel in safari Version 10.0 (Mac)

See original GitHub issue

This is the same issue that was created before #2626 but no one could reproduced and as result the ticket was closed. The issue is reproduced only in Safari (FireFox, Chrome works as expected). I’m using last version of D3 (4.2.2 and 4.4) The problem that D3 wheel zoom works only on g element and doesn’t work over svg element. Note dbClick zoom works over svg.

Steps of reproduce (Safari):

  1. Mouse over on red rect and start wheel zoom

zoom works

  1. Mouse over on svg element near of red rect

zoom doesn’t work

Note: there is exists some zones in svg (left and top) where zoom works. This illustration described in stackoverflow link.

One of possible work around is to insert transparent rect with full width and heigh before our rect and zoom will work for Safari. For example: <svg> <rect></rect> --------> this is transparent rect with full width and height <g> <rect></rect> --------> this is our red rect </g> </svg>

If someone can explain this behavior in Safari and especially explain ‘magic’ zones it would be great.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
mbostockcommented, Dec 9, 2016
  1. As stated in the ISSUE TEMPLATE you saw when you filed this issue, please file issues in the appropriate repository (in this case d3-zoom) not here.

  2. To make debugging easier, I ported the JSFiddle test case to bl.ocks.org: https://bl.ocks.org/mbostock/91b75091873d06add0666f35c2e6afb4.

    I’ve also updated the Reporting an Issue instructions to explicitly discourage the use of sites such as JSFiddle since the boilerplate makes debugging more difficult.

  3. As shown in the updated test case, this is a Safari bug (or if you like, an alternative interpretation of the specification). Safari does not dispatch wheel events to the SVG when there is no SVG content under the pointer; the events get sent to whatever is underneath the SVG element (the body in this case). In contrast other browsers dispatch wheel events to the SVG element anywhere inside its bounding rect.

    If you want the SVG to receive the event on all browsers, you must put some content in the SVG to capture the wheel event. Here is a fixed test case: https://bl.ocks.org/mbostock/9e3fed7a5904991e7973a87628d9f84d

1reaction
karlcowcommented, Aug 25, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

D3.Js Zoom Is Not Working With Mousewheel In ... - ADocLib
Zoom in / out functionality using mouse wheel; Magnified image can be moving and leaving and image zooming events; Display loading text while...
Read more >
D3.js zoom is not working with mousewheel in safari
Quite different behavior with Safari browser (my version is Version 10.0.1 (12602.2.14.0.7) ). Wheel zoom works for g element and doesn't work ......
Read more >
Mouse scroll plus Control will not ZOOM with Lion OSX 10.7
Mouse scroll plus Control will not ZOOM with Lion OSX 10.7. Used to use the Control button with the scroll wheel to zoom...
Read more >
D3.js zoom is not working with mousewheel in safari-d3.js
Safari does not dispatch wheel events to the SVG when there is no SVG content under the pointer; the events get sent to...
Read more >
Safari on Mac Scroll Wheel does not Zoom In/Out it...
To reproduce this, load this HTML in your browser and test on a Mac OS X Lion using Safari. Then using your mouse's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found