A4A: amp4ads-boilerplate setting hidden and not getting cleared
The A4A format spec calls for an amp4ads-boilerplate block of the style:
<style amp4ads-boilerplate>body{visibility:hidden}</style>
This is currently inserted by A4A code here. The assumption was that the AMP runtime CSS would disable this hidden attribute, allowing the ad to display. However, it appears that the hidden styling is not currently being disabled, so A4A-compliant ads are never actually displayed.
Proposed fix is to remove the boilerplate insertion from amp-a4a.js, but we should revisit this issue in the format spec and/or runtime.
Please revert the temporary fix and fix it in a good way.
Will do. Thanks for getting the temporary fix in. We have a couple of other high-priority things that we're hoping to get for this week's cut, so we'll probably work on the real fix for this issue for next week's cut. Thanks!
@dvoytenko do you want to persue the "correct" fix mentioned by @lannka or shall we?
Ideally we could get the "emergency" fix in ASAP given AMP creatives are currently broken. FYI - if you look at a text add (force_a4a_ctypes=1), you'll notice that visibility:hidden on body does not actually cause the arrow to disappear as it is an SVG. You may want to use opacity instead given that's what some quick google searches suggested.
I can take a look. Given that we had the the temporary fix, I suppose this is not that emergent now?
Do you know how did this bug get in? Was it working before?
It is only emergent in the sense that it will take >1 week for the fix to be live.
I do not know how this bug occurred... I had tested locally when adapting A4A to friendly iframe and it was not present. I will go ahead and update our selenium tests to include the most recent changes (in parallel we are working on building them from github head/production).
To confirm, is this for a "friendly iframe" a4a case or 3p iframe? If it's "friendly iframe" - we don't really need this boilerplate since we control the complete lifecycle and can easily flip visibility bits. If we still want it - feel free to send a PR to force visibility on the body of the iframe. It'd go here: https://github.com/ampproject/amphtml/blob/master/src/friendly-iframe-embed.js#L155
If it's a 3p case - let me know. I believe it should just work.
It is the friendly iframe case. I'm indifferent about leaving the boilerplate so let's go with what's simplest (not including it). SG?
Sounds great! But for posterity, it is needed for 3p case though. Right?
/cc @Gregable FYI
The root issue is that the A4A format spec says that the boilerplate line should be there in all A4A creatives, which may cause problems in the future. So, for the moment, not inserting the boilerplate in that line of the client code is fine. But for the future, we'll be seeing A4A creatives generated with it. We need to either kill it from the format spec (and validator) or twiddle the AMP runtime to handle it. Personally, I have no preference between the two. My understanding is that the boilerplate was there to keep the ad content hidden until it was completed rendering, but I'm not sure that we have any way to know that for A4A creatives.
Opinions on the best course?
I'd say the best course depends on 3p case because we control friendly iframe case very well - as well as boilerplate would know. In 3p case I think the boilerplate is necessary. So I see two important cases here:
- When AMP shows a4a as 3p, e.g. because validation fails.
- When a non-AMP document is showing a4a.
I think both of these warrant boilerplate. But I'm not 100% if my assumptions here are right.
I would leave it in the spec for the 3p case but I also think it is ok to remove for the friendly iframe (have the validator group it with other content to be removed).
On Oct 19, 2016 2:04 PM, "Dima Voytenko" [email protected] wrote:
I'd say the best course depends on 3p case because we control friendly iframe case very well - as well as boilerplate would know. In 3p case I think the boilerplate is necessary. So I see two important cases here:
- When AMP shows a4a as 3p, e.g. because validation fails.
- When a non-AMP document is showing a4a.
I think both of these warrant boilerplate. But I'm not 100% if my assumptions here are right.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/5663#issuecomment-254893243, or mute the thread https://github.com/notifications/unsubscribe-auth/ABr0LzhbQS6zTQBbW8d1GhIAh4MshYeBks5q1luwgaJpZM4KaMUH .
+1 to leave it in the spec and validation rule.
It can be removed at runtime for the case of friendly iframe, just like how we remove v0.js.
Which actually means the current fix is the correct fix.
Agreed
On Oct 19, 2016 2:17 PM, "Hongfei Ding" [email protected] wrote:
Which actually means the current fix is the correct fix.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/5663#issuecomment-254896767, or mute the thread https://github.com/notifications/unsubscribe-auth/ABr0L9jf0LrB7E5Mnc6Hu9FuLlKNoeOxks5q1l6ogaJpZM4KaMUH .
I admit that I don't understand the boilerplate functionality terribly well, so help me out. In the 3p case (either 3p iframe in AMP page or amp-inabox on non-AMP page), how does the hidden attribute get removed? Is that done by the AMP runtime when it boots?
@tdrl yes, as I pointed out in the PR review, it happens here
The boilderplate CSS serves as a 8s timeout. If the above code is not called, the page will become visible after 8s.
Removing the boilerplate in friendly iframe was the correct fix.