Skip to content

Conversation

scart88
Copy link

@scart88 scart88 commented Jul 2, 2025

Lighthouse throw the following recommendation for improving the scrolling performance:

Consider marking your touch and wheel event listeners as passive to improve your page's scroll performance

This PR should address the errors, however, I wasn't able to test locally.

Improve scrolling performance

Lighthouse error:
```
Consider marking your touch and wheel event listeners as passive to improve your page's scroll performance
```
@Valexr
Copy link
Owner

Valexr commented Jul 3, 2025

I can't test this locally too - haven't lighthouse ;)
With passive listeners we can't use event modifiers like e.preventDefault()... & other - they are using for avoiding native browser behaviour
Advertising network want to all sites will be reachable for she's logic... ;)

@Valexr
Copy link
Owner

Valexr commented Jul 3, 2025

Tx for your's collab 👍🏻

@scart88
Copy link
Author

scart88 commented Jul 3, 2025

I think Lighthouse complains because the scroll event doesn't have passive: true.
I notice that scroll function doesn't use preventDefault so I thought it would be safe to add passive: true, however, I wasn't able to run the build locally.

[
            'scroll',
            () => {
                to(INDEX);
                GRAVITY = 2;
            },
],

@Valexr
Copy link
Owner

Valexr commented Jul 3, 2025

you need use pnpm for building

@Valexr
Copy link
Owner

Valexr commented Jul 3, 2025

not scroll event

Screenshot 2025-07-03 at 12 15 08

@scart88
Copy link
Author

scart88 commented Jul 3, 2025

Oh I see. I tried with pnpm, however, I got several errors and the build failed.

Dang!

Do you think this line would be this line?
https://github.com/Valexr/Slidy/blob/main/packages/core/src/lib/slidy.ts#L86

Something like this would make a difference? I notice that onWheel never calls e.preventDefault();
node.addEventListener('wheel', throttle(onWheel, DURATION, CLAMP), { passive: true });

Thank you so much for your attention!

@Valexr
Copy link
Owner

Valexr commented Jul 4, 2025

I think lighthouse talk about specific places of prevention passive mode. And recommends removing them to allegedly increase the performance of the page scroll.

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.

2 participants