问题
Does the Cumulative Layout Shift metric stop measuring on user-interaction? Google's guidance on Cumulative Layout Shift says:
Layout shifts that occur in response to user interactions (clicking a link, pressing a button, typing in a search box and similar) are generally fine, as long as the shift occurs close enough to the interaction that the relationship is clear to the user.
回答1:
It's important to remember that Cumulative Layout Shift (CLS) is not just focused on page load. Many of the most problematic layout shifts we see happen after the initial load of a page has completed. You may have started reading an article or scrolled when all of a sudden content "shifts" because of an ad that has been injected or updated.
So, CLS is accumulated until a page reaches unload. It does not "stop" measuring upon a user input, as one of the goals of the metric is to measure the experience real users have of unstable page layouts.
You might wonder if this means that long-lived pages or sessions could end up with a worse CLS. There is thought going into how best to factor in this nuance this via the WebPerf Working Group. Ultimately, we need to normalize how we measure metrics like layout shift across the length of a session.
来源:https://stackoverflow.com/questions/62722217/does-cumulative-layout-shift-stop-measuring-on-user-interaction