amp-ad>iframe doesn't resize upon orientation change
@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!
@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!
/cc @ampproject/wg-ads @jasti
@lannka @jasti @mrjoro @zhouyx hey team! been about 30 days since i reported this bug... any thoughts? thanks!
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.
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 @keithwrightbos Any update here? We have site teams asking on the regular. Thanks!
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 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. :)
@lannka to respond to flying-carpet proposal. Let me know if min-width works, thanks!
@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!
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 gotcha... I'll simply assign an id to the amp-ad and create specificity that way. Thanks!