-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix native ads cut off with max height #1419
Conversation
🦋 Changeset detectedLatest commit: b64c6ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
d194498
to
e4b3b05
Compare
Ad load time test resultsFor Test conditions:
|
src/core/messenger/resize.ts
Outdated
@@ -62,6 +62,8 @@ const resize = ( | |||
styles.height = normalise(specs.height); | |||
} | |||
|
|||
adSlot.style.maxHeight = 'none'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be inside the fastdom.mutate
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to be immediately applied in fastdom.mutate
e4b3b05
to
4db8a9a
Compare
src/core/messenger/resize.ts
Outdated
@@ -67,6 +67,7 @@ const resize = ( | |||
|
|||
if (iframeContainer) { | |||
Object.assign(iframeContainer.style, styles); | |||
adSlot.style.maxHeight = 'none'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the iframeContainer
conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this would be appropriate, as we need an iFrameContainer to be present in order to apply the styling?
Do you mean to add the styling regardless of conditions?
return fastdom.mutate(() => {
Object.assign(iframe.style, styles);
if (iframeContainer) {
Object.assign(iframeContainer.style, styles);
}
adSlot.style.maxHeight = 'none'; // Applied regardless of iframeContainer
});
f81e546
to
b64c6ec
Compare
What does this change?
This allows the viewport to be made <980px in width or to change orientation on an iPad without the native ad getting cut off at the the bottom.
Why?
Native ads
resize
on render and therefore change ratio (width and height), therefore when we reduce the width of the viewport or change the orientation on the iPad the bottom gets cut off.The CSS states a max-height of 624px which persists at all breakpoints.
The
resize
is a Post Message, so when messenger tells us to resize (which only happens for in-house creatives) it should also check the container and remove max-height if necessary.Screenshot