amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-video-docking causes a CLS on floating/docking

Open zetagame opened this issue 5 years ago • 3 comments

What's the issue?

When testing with several video players (including amp-video and amp-youtube) amp-video-docking incurs a CLS and increases the score in Web Vitals by ~.026 on float and ~.015 on docking.

How do we reproduce the issue?

https://jsbin.com/sudacim/edit?html,output

  1. Select the player you wish to test.
  2. Press play
  3. Scroll until it floats, docks.
  4. Check the console

What browsers are affected?

Tested on Chrome as it pertains to Web Vitals

Which AMP version is affected?

0.1

zetagame avatar Apr 01 '21 16:04 zetagame

Investigating.

If I turn on Rendering > Layout Shift Regions on devtools, the reported regions are quite distant from the video's position. This is likely from the docking actions alternating position: static, absolute and fixed.

https://user-images.githubusercontent.com/254946/113368232-17546280-9313-11eb-82a2-d41919a24b6e.mp4

alanorozco avatar Apr 02 '21 00:04 alanorozco

Still investigating but some good news.

I've tried this in the Canary version of Chrome (91), and some changes in reporting have alleviated this problem.

The CLS event count went down from three to just one.

I suspect that the remaining shift is caused by switching from position: fixed to absolute when undocking. This makes sense if the previous three events were caused by position changes:

  • docking: static to fixed
  • undocking :fixed to absolute, then static

https://user-images.githubusercontent.com/254946/113602805-ef594d80-95f7-11eb-9c17-d380970fe915.mp4

alanorozco avatar Apr 05 '21 17:04 alanorozco

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 19 '25 05:07 stale[bot]