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 for passive flag? #20

Open
prayerslayer opened this issue Nov 20, 2017 · 2 comments
Open

Support for passive flag? #20

prayerslayer opened this issue Nov 20, 2017 · 2 comments

Comments

@prayerslayer
Copy link

Hi, thanks a ton for this component.

I'm seeing perf warnings in my Chrome because of the non-passive event handler on touchmove. MDN says the passive flag is basically a promise from the developer to the browser to never call preventDefault in the handler.

How would you feel about a passive boolean property on the ClickOutside component that's passed down to addEventListener?

@boblauer
Copy link
Owner

Thanks for the link, I wasn't aware of the passive flag.

Out of curiosity, what version of Chrome are you using? The reason I ask is because MDN says the passive flag is defaulted to true starting in Chrome 56 on touchstart and touchmove events.

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Improving_scrolling_performance_with_passive_listeners

@prayerslayer
Copy link
Author

Hm, I'm running Version 61.0.3163.100 (Official Build) (64-bit). I couldn't find a source for passive flag being true if not provided in Chrome, the best I got is this. So apparently it's only sometimes true by default? Maybe the "enabled by default" just means the Chrome feature flag?

Dunno if we care about IE or Edge 15, but those don't support passive event listeners, and providing an option argument to them would be detrimental.

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

2 participants