Skip to content
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

preventMouseEventsDefault stops working on Chrome 73 #331

Open
mariodebian opened this issue Mar 20, 2019 · 6 comments
Open

preventMouseEventsDefault stops working on Chrome 73 #331

mariodebian opened this issue Mar 20, 2019 · 6 comments

Comments

@mariodebian
Copy link

Bug report

The option preventMouseEventsDefault disable scroll event, allowing wheel-zoom.
With new Chrome 73 version: https://www.chromestatus.com/features/6662647093133312 they change to passive by default.

Expected behaviour

Zoom with mouse wheel without scrolling.

Actual behaviour

Mixed strange behaviour zoom+scroll.

Steps to reproduce the behaviour

  1. With Chrome/Chomium 73, go to demos, and open any.
  2. Resize your browser with a height < lion picture
  3. Use your mouse wheel over the picture

image

Configuration

@dreadknought
Copy link

dreadknought commented Apr 17, 2019

For the devs:
Need to change addEventListeners to specify that passive is false. The typical use is:
document.addEventListener('wheel', (evt) => { // ... do stuff with evt }, true)

With the recent (breaking) changes in Chrome where preventDefault doesn't work on document level wheel events, would need to change the above example to:
document.addEventListener('wheel', (evt) => { // ... do stuff with evt }, { capture: true, passive: false })

Additional info:
https://docs.google.com/document/d/1dLxnzyixmR9MeHXE75Uz2nIVA0PaEjN4W3V_-df0sYI/edit#

@nikhiljutla01
Copy link

Hi Dreadknought ,
I tried the above changes in addEventListeners but did not achieve desired result.
Please give your point and provide more info reg the same.
Thanks in advance !

@kovalchukq
Copy link

document.getElementById('yourSVGObject').addEventListener( 'wheel', e => { e.preventDefault(); }, { passive: false } );
This solution works for me!

@ariutta
Copy link
Collaborator

ariutta commented Oct 29, 2019

Hi @mariodebian, could you review this pull request to verify it solves this issue:
#355
Thanks!

@BodoMinea
Copy link

For now people who encounter this issue may try cloning and building from https://github.com/Bigfellahull/svg-pan-zoom, the repo from where the PR came. That´s what I did and it worked.

@murtraja
Copy link

When will this get merged? Facing same issue: on using the mouse wheel, the svg and web page both respond

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants