-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Twitter bento component does not resize properly #37117
Comments
Compare with the sizing of the non-Bento component: https://bento-twitter-intersection-observer-issue.glitch.me/non-bento.html Lazy construction should happen before the component actually entered the viewport. It should happen when it hears the viewport. I believe amp-img uses 3 viewport heights and amp-iframe uses 1 viewport height for distances, or something to that effect. |
I investigated this issue further and found this issue is not with the lazy construction as the amp-twitter gets built earlier in the viewport before it comes into the viewport. The issue is with the |
@westonruter I could not figure out any other solution to fix this issue without using the |
I think this is the crux of the problem. It should rather resolve when the embed nears the viewport, not when it is actually inside the viewport. I recall that See the amphtml/extensions/amp-youtube/0.1/amp-youtube.js Lines 129 to 136 in 1ba0a82
Compare with the default value in the base class: Lines 489 to 501 in cd80895
|
@westonruter The |
@deepaklalwani97 I don't quite understand, are you calling |
@adamsilverstein Yes, calling the createTweet returns a promise and it is only getting resolved only when it comes in the viewport, and manually calling the |
Ah, so the problem is that Twitter's own embed API is asynchronous (naturally). But if you set the equivalent of |
@westonruter No, even if we set the |
OK, right. So the issue is that Twitter is deferring the initialization until it comes inside the viewport. I guess the only two options I see are:
|
I wonder if we can somehow hack this. When the embed is out of view we could initially style the actual twitter embed as |
Oh yes, that's brilliant. |
@alanorozco Thanks for your suggestion I have created a PR #37740 with your mentioned workaround with this the embed now gets resized as soon as the component gets built when shown below the fold. Can you review and provide any necessary feedback. |
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. |
This issue is also present in both the 0.1 and 1.0 versions of the standard amp-tweet component when using a timeline source. The embedded timeline does not resize correctly within the amp iframe, causing it to be displayed at 1px wide and invisible |
Description
The Twitter bento component does not resize properly when the page is scrolled fast. The embed shows the unexpanded state with an expand button. In both cases, the Tweet embed will appear unbuilt when it is first scrolled into view. This indicates the intersection observer needs to be tweaked for lazy construction of the embed. This issue occurs only for the amp-twitter-1.0 version the amp-twitter-0.1 works as expected check this example for reference.
Reproduction Steps
Open https://bento-twitter-intersection-observer-issue.glitch.me URL and scroll quickly to the Twitter embed the embed should appear in non expanded state.
Relevant Logs
Browser(s) Affected
No response
OS(s) Affected
No response
Device(s) Affected
No response
AMP Version Affected
No response
The text was updated successfully, but these errors were encountered: