amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

[Layers] Elements initially more than 3 viewports down in position fixed container not getting rendered

Open yajiv185 opened this issue 8 years ago • 7 comments

What's the issue?

If we have 'amp-img' inside 'amp-list' and that 'amp-list' is inside some 'div'(or any other tag) which has position: fixed css property, then 'img' which are not in viewport are not rendering.

Let's say there are 10 images and in viewport we can able to see 5 images then 5(+2/3) images are rendering others(last 2-3) image will not render.

How do we reproduce the issue?

See this sample. In this sample if we remove class="position" from div which is immediate parent of 'amp-list' then all image are rendering, but if we add that class only few images are rendering.

To reproduce it just create a parent div of amp-list(amp-list must contain amp-img inside it, and if items in amp-list is more(>10) then we can see that last some image will not render..), div must contain css property position: fixed.

What browsers are affected?

All browsers.

yajiv185 avatar Mar 23 '18 12:03 yajiv185

@cathyxz Any update.

yajiv185 avatar Apr 09 '18 10:04 yajiv185

This issue seems to be in Pending Triage for awhile. @cathyxz Please triage this to an appropriate milestone.

ampprojectbot avatar Sep 11 '18 09:09 ampprojectbot

Took a look at this, and the bug actually isn't unique to <amp-list>. I think it happens to all elements more than 3 viewports down inside position fixed elements (e.g. https://codepen.io/cathyxz/pen/MPxYYE). I put a breakpoint in <amp-img>'s layoutCallback and it seems like the runtime isn't calling layoutCallback for these elements as they scroll into view.

Not sure if @jridgewell 's work on fixed-layer is intended to fix this behavior?

cathyxz avatar Oct 27 '18 09:10 cathyxz

Layers might fix this.

dreamofabear avatar Oct 29 '18 19:10 dreamofabear

I think it happens to all elements more than 3 viewports down inside position fixed elements

Correct, this is a limitation in the Resources measurement system. Only the document viewport's scroll box is officially supported, all else is a best effort.

Not sure if @jridgewell 's work on fixed-layer is intended to fix this behavior?

No, this is out of scope for FixedLayer.

Layers might fix this.

Correct, toggling the layers experiment fixes it.

jridgewell avatar Oct 29 '18 21:10 jridgewell

This issue hasn't been updated in awhile. @jridgewell Do you have any updates?

ampprojectbot avatar Feb 13 '19 04:02 ampprojectbot

@jridgewell: can we close?

samouri avatar Jul 19 '21 18:07 samouri