-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Description
The amp-tiktok
docs state:
Avoiding Layout shift
Prevent layout shift by matching the
width
andheight
attributes on theamp-tiktok
element to the size of the video player.By default, the width of the
amp-tiktok
iframe is 325px, resulting in a hight of roughly 575px. The default height of the embedded TikTok video player depends on the length and content of the TikTok caption. To show the entire video, theamp-tiktok
component resizes to match the player height. You can avoid this by defining the width and height to match the video player.
I tried following this advice and obtaining the exact height of the element after the page has loaded:
<amp-tiktok height="721" layout="fixed-height" data-src="https://www.tiktok.com/@countingprimes/video/6988237085899574533"></amp-tiktok>
Nevertheless, there is layout shift that is happening when the video loads:
amp-tiktok-layout-shift.mov
While the page ends up with the same initial layout, there is a moment when the amp-tiktok
grows too tall before shrinking back down.
Reproduction Steps
Try example on AMP Playground.
Relevant Logs
No response
Browser(s) Affected
No response
OS(s) Affected
No response
Device(s) Affected
No response
AMP Version Affected
2108052321001