You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an autocomplete is attached to an input which width changes frequently (like in an animation), browsers throw errors originating in ResizeObserver. Chrome and Firefox do not display these errors in the console. Only Safari shows them. You have to listen to the onerror event to surface these errors. Tools like Cypress and monitoring tools for JS errors notice these errors as an unhandled exception.
Error message in Chrome: ResizeObserver loop limit exceeded
Error message in Firefox and Safari: ResizeObserver loop completed with undelivered notifications.
Even though these errors are raised, the overlay is correctly positioned, sized, and works just fine.
There appears to be a consensus that these errors can be safely ignored. But at the same time this is very annoying since this process of ignoring it must be configured for all kinds of tools. Therefore it should still be desirable to prevent these errors from appearing.
I will activate animationFrame in the autoUpdate call. If this goes well and there is no negative feedback after a release, this implementation will remain in the lib. If something breaks or negative feedback is reported, I would consider either reverting (and recommending to ignore the errors) or implement an API option to toggle between the two implementations.
The text was updated successfully, but these errors were encountered:
Browser errors with ResizeObserver
Reproduction
Open https://stackblitz.com/edit/resizeobserver-bug?file=index.html and focus the input. The error messages will be added to the DOM bellow the input.
Description
When an autocomplete is attached to an input which width changes frequently (like in an animation), browsers throw errors originating in ResizeObserver. Chrome and Firefox do not display these errors in the console. Only Safari shows them. You have to listen to the
onerror
event to surface these errors. Tools like Cypress and monitoring tools for JS errors notice these errors as an unhandled exception.ResizeObserver loop limit exceeded
ResizeObserver loop completed with undelivered notifications.
Even though these errors are raised, the overlay is correctly positioned, sized, and works just fine.
Research about the error messages
Research conclusion regarding error messages
There appears to be a consensus that these errors can be safely ignored. But at the same time this is very annoying since this process of ignoring it must be configured for all kinds of tools. Therefore it should still be desirable to prevent these errors from appearing.
Research into possible fixes
A suggestion mentioned when researching the error messages is to use
requestAnimationFrame
: https://stackoverflow.com/a/58701523Based on the above linked answer this library updated its implementation: nolimits4web/swiper@0567641
Using
requestAnimationFrame
was also suggested for floating-ui but rejected: floating-ui/floating-ui#1740 (comment)Nevertheless floating-ui has an option on
autoUpdate
to useanimationFrame
: https://floating-ui.com/docs/autoupdate#animationframeConclusion
I will activate
animationFrame
in theautoUpdate
call. If this goes well and there is no negative feedback after a release, this implementation will remain in the lib. If something breaks or negative feedback is reported, I would consider either reverting (and recommending to ignore the errors) or implement an API option to toggle between the two implementations.The text was updated successfully, but these errors were encountered: