ampproject / ampproject/amphtml

Twitter bento component does not resize properly

Open
#37,117 18 comments 0 reactions 0 assignees View on GitHub
Component: amp-twitter Type: Bug WG: bento WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### 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](https://bento-twitter-intersection-observer-issue.glitch.me/non-bento.html) for reference.

![ezgif com-gif-maker](https://user-images.githubusercontent.com/32839217/144855023-c3c72b6f-398a-4b3b-8018-99ba38311fca.gif)

### 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

```shell
Uncaught (in promise) Error: changeSize attempt denied
at Object.callback (mutator-impl.js:79)
at Pj (resources-impl.js:927)
at h (resources-impl.js:1642)
at Gj.setState (finite-state-machine.js:53)
at Ij.g.doPass (resources-impl.js:643)
at resources-impl.js:538
at Ll (vsync-impl.js:456)
at Hl.g.Bh (vsync-impl.js:413)
```

### Browser(s) Affected

_No response_

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue at the linked Glitch URL, scrolling quickly to the amp-twitter-1.0 embed and comparing it with amp-twitter-0.1. Then inspect the amp-twitter-1.0 intersection-observer behavior around lazy construction. Done means the embed resizes into its non-expanded state when scrolled into view without the reported changeSize error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.