Skip to content
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

amp-social-share causes layout shift on upgrade #30649

Open
kevinkimball opened this issue Oct 14, 2020 · 4 comments
Open

amp-social-share causes layout shift on upgrade #30649

kevinkimball opened this issue Oct 14, 2020 · 4 comments

Comments

@kevinkimball
Copy link
Contributor

What's the issue?

When .i-amphtml-unresolved class is removed on component upgrade, overflow is changed from hidden to visible, which causes subsequent elements to shift (both sibling inline element and following image).

This issue was surfaced by this issue from the Page Experience tool (ampproject/wg-performance#48).

This may be related to #27228 but data-mode=replace is not used in the example.

How do we reproduce the issue?

Visit the URL below with "Layout Shift Regions" enabled in Rendering tab of Chrome Dev Tools to visualize the layout shift.

https://tasty.co/amp/recipe/garlic-bread-bruschetta

What browsers are affected?

Chrome 87

Which AMP version is affected?

2009252320001

@nainar
Copy link
Contributor

nainar commented Oct 19, 2020

This is a high priority if this is causing CLS issues - it is a highly used AMP component.

@zhouyx to assign and @caroqliu for context.

@rbeckthomas
Copy link
Contributor

On potential solution for this would be to permanently add the overflow: hidden; style to this component.
However this change would be backwards incompatible and would require a new revision of the social-share component.

@alanorozco, @kristoferbaxter, @krdwan Do you have any thoughts the correct path forward?

@caroqliu
Copy link
Contributor

caroqliu commented Feb 10, 2021

Discussed offline with @rebeccanthomas:

The "print" button appears to have display: inline-block which aligns itself to the baseline of the amp-social-share icons. It looks like applying overflow: hidden; vertical-align: top; to the amp-social-share selector will fix it for this particular document, not sure about others. Alternatively, the developers for could applyvertical-align: top; to their Print button and fix that part of the page's CLS without us making any changes to amp-social-share.

Do we have other sample documents @kevinkimball?

Short term recommendations:

  • Apply overflow: hidden; vertical-align: top; on the repro case.
  • Investigate if the overflow: hidden from .i-amphtml-unresolved can be overridden to be overflow: visible for amp-social-share.i-amphtml-unresolved in the ampshared.css as @rebeccanthomas mentioned above.

Long term recommendation:

  • This further strengthens the case for a no-CLS v2 redesign. :)

@stale
Copy link

stale bot commented Aug 12, 2022

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 stale bot added the Stale Inactive for one year or more label Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants