Jump to content
Search Community

GSAP Observer and passive listening Lighthouse diagnosit

cselin test
Moderator Tag

Recommended Posts

I don't have a demo as this is more of a general question. 

 

I have a site using Observer to control a few things on the page, such as when a header appears or disappears depending on scroll direction. In Google's Lighthouse, I get this feedback: 

 

Quote
Consider marking your touch and wheel event listeners as `passive` to improve your page's scroll performance. Learn more.
 

 

The link - https://developer.chrome.com/docs/lighthouse/best-practices/uses-passive-event-listeners/?utm_source=lighthouse&utm_medium=devtools - Suggests that the 'passive' flag should be added to scroll event listeners.

 

Is there a way that Observer could be modified to comply with this Lighthouse report issue? Has this been discussed elsewhere? 

 

This isn't something critical for me but I have some clients that are passionate about their lighthouse score so would be good to come back to them with further information if this cannot be changed. 

Link to comment
Share on other sites

Hi,

 

I don't recall any discussion of the sort. Reading this could give some idea regarding the subject:

https://stackoverflow.com/a/37721906/2456879

 

I'm not entirely sure if I can help you with this, but this could be tied to the scroll thread and how observer works under the hood. @GreenSock should be the one to answer this.

 

Maybe you're using preventDefault in your observer configuration object? Is the only thing I can think of that could be causing this, beyond that I can't think of anything else.

 

Sorry I can't be of more assistance. Please stand by for a more official response.

Happy Tweening!

Link to comment
Share on other sites

  • 2 weeks later...

Yeah, for some of the functionality, Observer can't just blanket set passive: true stuff on event handlers. If you've got a particular situation that's causing problems for you, please feel free to post a minimal demo and we'd be happy to take a peek. Usually the defaults are pretty solid, though, and shouldn't cause any problems. Like @Rodrigo asked, did you maybe set preventDefault: true? That could be the cause if the issue in your case. 

Link to comment
Share on other sites

  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...