New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃殌 [Story performance] Make inactive pages not trigger LCP #35323
馃殌 [Story performance] Make inactive pages not trigger LCP #35323
Conversation
Hey @gmajoulet, @newmuis! These files were changed:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me quite some time to understand that your testing samples are overriding AMP.toggleExperiment('amp-story-desktop-one-panel', true)
.
I'll merge it so it gets to prod one week earlier, but in the future let's use the conventional experiment toggles
Two follow ups:
|
Text blocks will start outside of the page so they don't count towards LCP when activating this PR, but also didn't happen before. Since images load later, there was a chance that the image could be behind the current page when it loads, triggering LCP at that point. So, this PR fixes images but doesn't affect text on inactive pages, since they were never a problem. Also, making a PR now that doesn't toggle the experiment on the demo stories if the URL param is not present |
So all the cases we had where the LCP element was on page 2 was only images, never text nodes? |
By updating the way the inactive pages are positioned, we can make the inactive pages not count towards LCP. In this PR, we can set the pages with
distance="1"
to be outside the viewport only if they are not loaded (or previously visited), so that there's no background flash of black in between page advancements (unless the second page is not loaded already).Default: https://stories-demos-matias.web.app/examples/amp-story/performance/visibility.html
Fixed: https://stories-demos-matias.web.app/examples/amp-story/performance/visibility.html#load=outside
This PR will not affect the desktop 3 panels layout since the inactive pages are seen on the sides. The new desktop 1-panel UI does not show the inactive pages, so it is fixed by this PR (it doesn't set the mode to
desktop
). Can be tested with:AMP.toggleExperiment('amp-story-desktop-one-panel', true)