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

Support passive event handlers for mouse/touch events #162

Closed
itsjimbo opened this issue Nov 2, 2016 · 4 comments
Closed

Support passive event handlers for mouse/touch events #162

itsjimbo opened this issue Nov 2, 2016 · 4 comments

Comments

@itsjimbo
Copy link

itsjimbo commented Nov 2, 2016

Just to keep pace with the react team, maybe adding these options to the scroll/wheel listeners could boost performance..
facebook/react#6436

@rrag
Copy link
Owner

rrag commented Nov 2, 2016

I am using

react event listeners for mousemove, zoom, touch
d3 event listeners for pan actions, drawing interactive indicators

d3 event listeners also don't seem to support it yet

https://github.com/d3/d3-selection/blob/9c18dd488acc1c3b5582f069302ed3089edac032/src/selection/on.js#L70

for zoom which uses the mouse wheel listener, it has to be active listener so default action (which is page scroll) can be prevented.

For the rest of the events I guess we can benefit from this once React and d3 starts to support it.
even then if I remove the e.preventDefault() for the mousedown event action, depending on how you drag the chart, it selects the chart, like when you click and drag on text to select. While it is definitely worth investigating when the dependencies support it, the initial impression I get is that this will not solve our need

@rrag rrag closed this as completed Nov 2, 2016
@cj-clifton
Copy link

cj-clifton commented Apr 4, 2019

I'm getting this error in chrome when I scroll to zoom.

Unable to preventDefault inside passive event listener due to target being treated as passive.

I expect it to only zoom on the chart but it zooms and scrolls the page at the same time.
Is there somewhere I need to make the listener active?

@jedrichards
Copy link

Same here.

@alexbom
Copy link

alexbom commented Jan 23, 2020

Same error in Chrome. I'm using nextjs.

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

No branches or pull requests

5 participants