-
Notifications
You must be signed in to change notification settings - Fork 4k
🚀 [Story performance] Fix CLS caused from AMP runtime CSS showing story before amp-story.css #37990
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gmajoulet
approved these changes
Mar 31, 2022
Hey @gmajoulet, @newmuis! These files were changed:
|
1 similar comment
Hey @gmajoulet, @newmuis! These files were changed:
|
jridgewell
approved these changes
Mar 31, 2022
There's been a regression of some unrelated unit tests that this PR caught, I'm fixing them on #37994 and then merging this PR (these unit tests are blocking this merge) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On origin
ampshared.css
shows the document when v0.js is installed, but in many cases this happens in a different frame thanamp-story.css
being installed, meaning that for a split second the layout shows with just theampshared.css
styles and withoutamp-story.css
. When this happens, the active page can change the size (especially for inline elements that take space) which causes CLS=1.TL;DR: If amp-story.css is not present, we don't want to show the story due to possible CLS. On cached docs the CSS is inlined so this won't affect anything, but on origin this prevents a flash of unstyled story.
Somewhat reverts back #37345 but shows the story earlier (CSS installation is earlier than
layoutCallback
is completed).