instantsearch icon indicating copy to clipboard operation
instantsearch copied to clipboard

Event Passive Mode

Open fabroux opened this issue 7 years ago • 4 comments

With the chrome audit tool, in the best practices. I have an optimization to do for scroll preformances:

image

instantsearch.js: v2.2.4 in function setAccessor(): The listener is not in passive mode. if (!old) node.addEventListener(name, eventProxy, useCapture);

When i use "tooltips" option in rangeSlider widgets.

If you can show this.

(same problem with instantsearch demo only with "tourism" version) https://community.algolia.com/instantsearch.js/v1/examples/tourism/

Thanks

fabroux avatar Nov 17 '17 11:11 fabroux

Hello @fabroux thanks for opening this issue. This is something that we have overlooked. Would you be interested in providing a PR/fix for that?

PS: for reference, here is a complete guide about passive event listeners.

bobylito avatar Nov 17 '17 13:11 bobylito

Be careful with support here, the passive events variadic call isn’t supported anywhere. A light version https://github.com/rafrex/detect-passive-events might be needed

Haroenv avatar Nov 17 '17 14:11 Haroenv

As far as I can tell, we no longer have event listeners on scroll at all now, and I can't reproduce this warning. Good news :D

Haroenv avatar Dec 20 '19 10:12 Haroenv

I was wrong, we do have event handlers which are not passive on touch, not scroll:

https://github.com/algolia/instantsearch.js/blob/06eaac69204890f3c82d41ab9c5f9111ce42c21e/src/components/Slider/Rheostat.js#L375-L376

Haroenv avatar Dec 20 '19 11:12 Haroenv