amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-ad>iframe doesn't resize upon orientation change

Open coreybyrnes opened this issue 7 years ago • 12 comments

@lannka @zhouyx As reported in Slack, upon orientation change the amp-ad>iframe doesn't resize to fill the container. The amp-ad element has the proper width and fills its container, but the iframe's width doesn't change.

To note, my amp-ad tag has a layout of fixed-height and a height set to 60vh. Its parent/container has a width set to 100vw and a margin-left of -10px so it will span the entire width of the browser.

demo page: https://rev.cbsi.com/corey/test/amp/amp_demo_flying-carpet_736x741.html

Thanks for taking a look!

coreybyrnes avatar Mar 14 '19 15:03 coreybyrnes

@lannka @zhouyx @aghassemi Hey folks! Any update/progress on this? Some of our larger networks are looking to implement this "faux flying carpet" unit as soon as possible. Thanks!

coreybyrnes avatar Mar 21 '19 13:03 coreybyrnes

/cc @ampproject/wg-ads @jasti

mrjoro avatar Apr 02 '19 18:04 mrjoro

@lannka @jasti @mrjoro @zhouyx hey team! been about 30 days since i reported this bug... any thoughts? thanks!

coreybyrnes avatar Apr 12 '19 13:04 coreybyrnes

Hey @coreybyrnes, apologies for the delay. Some of the team has been out and we are a bit tied up with AMP conf next week. We'll have the team look into during the week of thee 22nd. Apologies for the delay!

CC @keithwrightbos @jeffkaufman for help if you have the bandwidth to take a look in the mean time.

jasti avatar Apr 12 '19 15:04 jasti

Sorry for the delay.

The size of the iframe is fixed by the doubleclick multi-size logic. code here .

In case there is no size info in the ad response, can we let the iframe always fill the parent container? @keithwrightbos what you think, could you triage?

lannka avatar Apr 24 '19 02:04 lannka

@lannka @keithwrightbos Any update here? We have site teams asking on the regular. Thanks!

coreybyrnes avatar May 13 '19 13:05 coreybyrnes

Apologies for the delay, I didn't realize this was assigned to me. On non-AMP pages via GPT we don't resize the iframe on orientation change as there is no way to ensure the creative within will respond "correctly" to the change. You could force the width by setting CSS amp-ad > iframe { min-width: 100% } on the page (same for min-height depending on your container). If you're looking for flying carpet behavior, have you tried amp-fx-flying-carpet?

keithwrightbos avatar May 14 '19 13:05 keithwrightbos

@keithwrightbos Thanks for the reply! I'll try min-width. The thought was since I'm not explicitly setting a width and height on the amp-ad, but instead using the data-overrides would not constrict the iframe's dimensions.

I have indeed tried the flying-carpet... I was try to make it work for about 1.5yrs. ;) In the end after fixing bugs and making mods it wouldn't work because sites want an overlay element (video or image) that scrolls with you. Here's an example of the faux-flying carpet with a video overlay that's pinned inside the visible window: https://rev.cbsi.com/corey/test/amp/amp_demo_flying-carpet_736x740.html. If the flying-carpet could be updated to provide an option to pin an element inside the visible window then I could scrap this "faux" flying-carpet attempt. :)

coreybyrnes avatar May 14 '19 13:05 coreybyrnes

@lannka to respond to flying-carpet proposal. Let me know if min-width works, thanks!

keithwrightbos avatar May 14 '19 14:05 keithwrightbos

@keithwrightbos I think min-width might work! I had to apply an !important to override another more specific amp-ad>iframe, but upon first glance I think it might work. Thanks for that recommendation!

coreybyrnes avatar May 14 '19 14:05 coreybyrnes

Ok be careful that you're not creating an invalid document as I believe AMP disallows !important but for now I'm going to close the issue. Please reach out if you need more assistance.

keithwrightbos avatar May 14 '19 14:05 keithwrightbos

@keithwrightbos gotcha... I'll simply assign an id to the amp-ad and create specificity that way. Thanks!

coreybyrnes avatar May 14 '19 16:05 coreybyrnes