instantsearch
instantsearch copied to clipboard
Event Passive Mode
With the chrome audit tool, in the best practices. I have an optimization to do for scroll preformances:
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
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.
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
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
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