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
Background
We use useViewportOffsetTop to properly display keyboard on small device on the mobile browsers
Problem
We noticed that window.scrollTo is being called frequently in useViewportOffsetTop, even when the target scroll position has already been reached. This logic is primarily necessary for small screens when using the app in a browser, but it is triggered unnecessarily on all devices.
Calling window.scrollTo causes redundant style recalculations, which can take up to 13ms.
Solution
We can add an additional check to prevent window.scrollTo from being triggered when the scroll position is already at the target. This optimization will eliminate unnecessary style recalculations and improve overall performance.
The text was updated successfully, but these errors were encountered:
Background
We use
useViewportOffsetTop
to properly display keyboard on small device on the mobile browsersProblem
We noticed that
window.scrollTo
is being called frequently inuseViewportOffsetTop
, even when the target scroll position has already been reached. This logic is primarily necessary for small screens when using the app in a browser, but it is triggered unnecessarily on all devices.Calling
window.scrollTo
causes redundant style recalculations, which can take up to 13ms.Solution
We can add an additional check to prevent
window.scrollTo
from being triggered when the scroll position is already at the target. This optimization will eliminate unnecessary style recalculations and improve overall performance.The text was updated successfully, but these errors were encountered: