amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-img not showing when inside a lightbox and outside of viewport initially

Open micyeung opened this issue 8 years ago • 3 comments

Start with an <amp-list> containing <amp-img> sitting inside an <amp-lightbox>, and with not initially in the screen viewport. When <amp-img> scrolls into the viewport, the image fails to lazy-load and be displayed.

Demo page: https://randomtestapp-a5a6f.firebaseapp.com/amp-img-not-showing-on-lightbox.html Open up the lightbox, and scroll down, and you'll see empty image boxes.

micyeung avatar Jan 06 '18 01:01 micyeung

Actually we encounter this kind of issue in various situation, the key problem is that while the <amp-img> is out of the viewport, it won't be rendered. Situations as follows:

  1. Multiple <amp-img> in a <div>, in order to simulate the dynamic carousel;
  2. Multiple <amp-img> in a <amp-lightbox>, when we using this to implement our feedback dialog in our product detail page, the img is not yet in the viewport would not be rendered even when you scroll down to it, and that time, the src already came back.

grahamle avatar Jan 06 '18 07:01 grahamle

/to @aghassemi

dreamofabear avatar Jan 06 '18 20:01 dreamofabear

@grahamle Thanks for reporting. For 1. Using horizontally scrollable div to mimic a carousel is not supported in AMP yet, you would need to use amp-carousel for that. For 2. If amp-lightbox is set to scrollable it would be supported but as the bug implies, it is broken. I am looking into fixing this ASAP.

aghassemi avatar Jan 08 '18 16:01 aghassemi