ampproject / ampproject/amphtml

Shadow AMP problem with fixed positioned containers

Open
#33,429 1 comment 0 reactions 0 assignees View on GitHub
Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

I'm using shadow AMP to build a web application. The AMP document needs to be rendered in a `position: fixed` container, with `overflow: scroll`

Normally, the AMP document renders and works fine, but occasionally I see that only the AMP extensions placed in the first viewport are loaded, and if you scroll inside the container the rest are not loaded, or it takes quite a long time to load.

You can see the result in the following screenshot

Screenshot 2021-03-23 at 12 13 10

Since now AMP uses Intersection Observer to load its resources, I though that there would be no problem to load the AMP document inside a fixed positioned container with overflow.

Is this true, or AMP still needs `window` scroll events to properly work?

[You can find here a gist](https://gist.github.com/oliverfernandez/43df1b0a569e4643095e7620be21bf20) where the issue can be reproduced. You can reproduce it more often if in Chrome, using the Dev Tools, you do a 4x CPU slowdown

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.