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

Always make wheel listeners not passive to allow preventDefault #3939

Merged
merged 8 commits into from
Mar 25, 2019

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Mar 22, 2019

URL of deployed dev instance (used for testing):

Steps to test:

  • used chrome v73 and scrolled in viewport with k/l scrolling > 1

Issues:


@philippotto philippotto self-assigned this Mar 22, 2019
Copy link
Member

@daniel-wer daniel-wer left a 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 :)

@@ -436,6 +436,28 @@ export function isNoElementFocussed(): boolean {
return document.activeElement === document.body;
}

const arePassiveEventsSupported = _.once(() => {
Copy link
Member

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.

element.addEventListener(
eventName,
wrapperFunc,
arePassiveEventsSupported() ? { passive: false } : false,
Copy link
Member

@daniel-wer daniel-wer Mar 25, 2019

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 daniel-wer changed the title Always make wheel listeners passive to allow preventDefault Always make wheel listeners not passive to allow preventDefault Mar 25, 2019
@philippotto
Copy link
Member Author

@daniel-wer Thanks for your feedback :) Done! If you approve, I'll merge this once the build succeeded.

@philippotto philippotto merged commit 3c11e92 into master Mar 25, 2019
philippotto added a commit that referenced this pull request Mar 25, 2019
* always make wheel listeners passive to allow preventDefault (fixes #3938)

* update changelog

* fix linting

* fix missing function call

* integrate pr feedback
hotzenklotz added a commit that referenced this pull request Mar 25, 2019
…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)
@normanrz normanrz deleted the fix-passive-wheel-listener branch August 12, 2019 09:46
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

Successfully merging this pull request may close these issues.

preventDefault for wheel events does not work for new chrome version
3 participants