simplebar icon indicating copy to clipboard operation
simplebar copied to clipboard

Unable to preventDefault inside passive event listener invocation.

Open barnu5 opened this issue 5 years ago • 3 comments

Great work on this. Hard work much appreciated.

Describe the bug 93 error count in the chrome console, of the message: Unable to preventDefault inside passive event listener invocation.

To Reproduce Steps to reproduce the behavior: Happening every time the slider loads

Expected behavior A clear and concise description of what you expected to happen.

Reproducible example

Additional context Add any other context about the problem here.

Your environment

Software Version(s)
SimpleBar "simplebar-react": "^2.1.0",
Browser chrome
npm/Yarn yarn, 1.21.1
Operating System Windows

barnu5 avatar Feb 12 '20 11:02 barnu5

Will you accept a PR for this?

It looks like the reason is because of changes in Google chrome.

It should be a simple one or two line fix.

If you can accept a PR, please let me know.

Thanks!

barnu5 avatar Feb 13 '20 05:02 barnu5

Hey, There have been various contributors on this project submitting PRs so of course I would accept one.

Thanks!

Grsmto avatar Feb 16 '20 17:02 Grsmto

We've come across this issue too. It sometimes happens with pointer devices (e.g. tablet devices or when using the touch device emulation in Google Chrome).

I think it would be enough to change e.preventDefault() to if (e.cancelable) e.preventDefault() at the 4 locations where preventDefault is called. I might try this out and potentially add a PR when I have time.

  • https://github.com/Grsmto/simplebar/blob/master/packages/simplebar/src/simplebar.js#L668
  • https://github.com/Grsmto/simplebar/blob/master/packages/simplebar/src/simplebar.js#L739
  • https://github.com/Grsmto/simplebar/blob/master/packages/simplebar/src/simplebar.js#L782
  • https://github.com/Grsmto/simplebar/blob/master/packages/simplebar/src/simplebar.js#L802

blutorange avatar Nov 11 '22 14:11 blutorange