Closed pbower closed 3 months ago
I've already done some changes for some of them, but it's just impossible to do it for all event listeners. Chrome doesn't make a distinction between what's possible and what's not, so I don't think that there's anything more that we can do to remove all warnings. In fact, I had tried in the past to apply the change to all events to remove the warnings but quickly realized it caused huge problems and even broke SlickGrid and so I had to revert the changes. So we can't always rely on Chrome warnings to do code changes.
see previous list of past PRs which I worked on and in the end, I had to revert all changes because Passive mode for event listeners should only be used when you are 100% sure that you won't ever call e.preventDefault()
and for many SlickGrid events, it's just impossible to know for sure. For example when editing, we will often use prevent default to avoid event bubbling.
Chrome warnings are not always valid, it only provides suggestions that if possible might improve perf (but in our case, it's not possible to apply the changes)
No worries, thanks for this.
Describe the bug
Hi there,
Hope all is well.
I'm receiving the following browser warnings with Slickgrid (latest version confirmed).
The warnings suggests a possible fix for slick.interactions.ts to increase performance by adding ' { passive: true }' to (at least some) of the event listeners. However, noticing that there are some preventDefaults called I am unsure if this is the correct solution.
Therefore, I'm wondering whether it's a case of adding 'passive: true' to some of the following event listeners?
Please kindly find details below.
Thanks heaps,
Regards, Peter
[Violation] Added non-passive event listener to a scroll-blocking event. Consider marking event handler as 'passive' to make the page more responsive. See
GridStore.tsx:127
It is traced back to the following event listeners in slick.interactions.ts (and associated bundle files):
Possibly:
and (for MouseWheel)
and (for Resizable):
and/or ResizingHandler:
Reproduction
Activate all available event listeners for Slickgrid and the warning shows (at least) in Chrome browser.
Which Framework are you using?
React
Environment Info
Validations