brainhubeu / react-carousel

A pure extendable React carousel, powered by Brainhub (craftsmen who ❤️ JS)
https://brainhub.eu/
MIT License
1.07k stars 164 forks source link

Passive Event Listeners Google Lighthouse #581

Closed Fubinator closed 4 years ago

Fubinator commented 4 years ago

Describe the bug If you install the slider and run Google's Lighthouse, the error "Does not use passive listeners to improve scrolling performance" appears under "Best Practices" (see screenshot). This is probably caused by multiple event listeners.

Expected behavior The message should not appear in a lighthouse report.

Screenshots image

Environment

System: OS: Linux 5.7 Arch Linux CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor Memory: 1.77 GB / 15.63 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Node: 14.4.0 - /usr/bin/node Yarn: 1.22.4 - /usr/bin/yarn npm: 6.14.5 - /usr/bin/npm Browsers: Firefox: 77.0.1 npmPackages: @brainhubeu/react-carousel: ^1.16.3 => 1.16.3

piotr-s-brainhub commented 4 years ago

@Fubinator

Thanks for reporting this.

Do you encounter this error only in the Google Lighthouse or maybe also in some other places?

Can you see this error for the docs https://brainhubeu.github.io/react-carousel/docs/examples/simpleUsage ?

Fubinator commented 4 years ago

@piotr-s-brainhub yes, i'm encountering the error for the docs:

image

In other places I have not yet seen the error. This is only about the given best practices of Google Lighthouse.

I've digged a little bit into the code and I think the error occurs in the following lines:

https://github.com/brainhubeu/react-carousel/blob/c1e255220609003cf468c558108cf81b6b57bd9e/src/components/Carousel.js#L97-L103

I am not exactly sure why there is one listener set to passive: false, but it may help if the other ones are set to passive: true

piotr-s-brainhub commented 4 years ago

Thanks @Fubinator , I also see this error.

Screenshot 2020-07-06 at 20 38 24
kelyvin commented 4 years ago

+1

I am seeing this warning in the chrome developer console when react-carousel loads.

Screen Shot 2020-07-13 at 3 45 56 PM

piotr-s-brainhub commented 4 years ago

@kelyvin so I invite you to like (👍) this issue we could compare issues by the number of 👍

kelyvin commented 4 years ago

You got it!

piotr-s-brainhub commented 4 years ago

thanks @kelyvin

RobertHebel commented 4 years ago

The issue has been fixed in v1.19.23. If the problem will occur for you please let me know and I will reopen this thread