-
Notifications
You must be signed in to change notification settings - Fork 24
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
Always make wheel listeners not passive to allow preventDefault #3939
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! I made two small suggestions, but it works as intended :)
frontend/javascripts/libs/utils.js
Outdated
@@ -436,6 +436,28 @@ export function isNoElementFocussed(): boolean { | |||
return document.activeElement === document.body; | |||
} | |||
|
|||
const arePassiveEventsSupported = _.once(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add that this is from https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support, in case we want to update or think about removing this code sometime in the future.
frontend/javascripts/libs/utils.js
Outdated
element.addEventListener( | ||
eventName, | ||
wrapperFunc, | ||
arePassiveEventsSupported() ? { passive: false } : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now every event listener attached with addEventListenerWithDelegation
is passive Edit: not passive, shouldn't we only do this for wheel
events? I'd suggest adding another optional parameter options
which is the same as the parameter to addEventListener
. When attaching the wheel
handler we can set passive to false there.
@daniel-wer Thanks for your feedback :) Done! If you approve, I'll merge this once the build succeeded. |
…/webknossos into fix-passive-wheel-listener
* always make wheel listeners passive to allow preventDefault (fixes #3938) * update changelog * fix linting * fix missing function call * integrate pr feedback
…ture-highlight * 'master' of github.com:scalableminds/webknossos: Hide unreported datasets (#3883) Update puppeteer and refresh screenshots (#3914) only show team names of own organization (#3928) Enable merger mode in skeleton and hybrid tracings (#3619) allow uploading nml for public dataset of different orga (#3929) Always make wheel listeners not passive to allow preventDefault (#3939) Enhance tree search functionallity (#3878) add webknossos-connect to setup (#3913) Update README.md (#3923) Add shortcut to maximize golden layout panes (#3927) Perform bucket picking in web workers and other performance optimizations (#3902) remove alt text for abstract brain loading image (#3930) updated documentation front page (#3917)
URL of deployed dev instance (used for testing):
Steps to test:
Issues: