lukeed / bee3d

Support Forum for Bee3D Slider, found @ http://www.lukeed.com/demo/bee3D
MIT License
7 stars 2 forks source link

setting event listners as passive #74

Closed bobita60 closed 5 years ago

bobita60 commented 5 years ago

hello, i contacted you on codecanyon last week. i need to make touch and wheel event listeners as passive.

lukeed commented 5 years ago

Hey, I remember – glad you came to GitHub~!

What have you tried so far? Also, by the way, a scrolling passive event listener doesn't do anything. And in most browsers, touch events are already marked as passive by default. See MDN docs for more info, in case you haven't already seen this.

What have you tried so far? What issues are you seeing, and where are you seeing them?

Thanks~

bobita60 commented 5 years ago

i need to pass the "best practices" audit in chrome (https://snag.gy/d2AhbL.jpg) i changed the following function: function n(e, t, n) { t.split(" ").forEach(function (t) { e.addEventListener(t, n, {passive: true}) }) } i don't know what else to try.

bobita60 commented 5 years ago

?

lukeed commented 5 years ago

Hey, sorry for delay – traveling.

Unfortunately, that's all there is to do. All event listeners are routed thru that on utility, so that would have been the only suggestion I had for you.

To be honest though, that report is wrong. Passive event listeners on the Lighthouse audit have changed frequently. If you had tested this a few months ago, or test it again in a few months from now, it will probably pass.

Technically, too, it can't outright say that non-passive touch listeners are bad. There are UI interactions that distinctly require a non-passive touchmove to operate.

Personally I'd ignore this for now. Not only is there nothing more you can do, but it has changed and will likely change again.

I ran the audit on my end & there are much larger wins/gains to be had, completely unrelated to Bee3D. Posting for your records, as another datapoint if nothing else :)

Closing since there's nothing more to be done here & it's a misclassified issue.

blob_chrome-extension___blipmdconlkpinefehnmjammfjpmpbjk_25c0f04d-adf9-4fc7-b65b-daeddab065ca

lukeed commented 5 years ago

Related: https://github.com/GoogleChrome/lighthouse/issues/9315

As described above, the presence of a ev.preventDefault within a touch listener is causing the misdiagnosis. If you really want to remove the audit item, you can remove the e.preventDefault(); from within the features/mouseDrag.js file – however, this is very likely break the interaction.

  handleMove = function (e) {
    e.preventDefault(); // <~ this
    delta = e.x - start;
  },
bobita60 commented 5 years ago

thanks. removing preventDefault fixed the problem.