-
Notifications
You must be signed in to change notification settings - Fork 385
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
Improve handling of Tumblr embeds #5926
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #5926 +/- ##
=============================================
+ Coverage 74.96% 75.31% +0.34%
- Complexity 5675 5703 +28
=============================================
Files 212 214 +2
Lines 17049 17242 +193
=============================================
+ Hits 12781 12985 +204
+ Misses 4268 4257 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Plugin builds for ad2e9be are ready 🛎️!
|
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.
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
It should, as the iframe document is sending a window.parent.postMessage({
sentinel: "amp",
type: "embed-size",
height: document.body.scrollHeight
}, "*") Ref: https://assets.tumblr.com/client/prod/standalone/embeddable-internal/index.build.js |
From the docs on resizing
So it seems neither of those were happening in your case. |
'overflow' => '', | ||
'tabindex' => 0, | ||
'role' => 'button', | ||
'aria-label' => __( 'See more', 'amp' ), |
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.
Why is the aria-label
needed if the button text is the same?
'div', | ||
[ | ||
'width' => $this->args['width'], | ||
'height' => $this->args['height'], | ||
'layout' => 'responsive', | ||
'sandbox' => 'allow-scripts allow-popups', // The allow-scripts is needed to allow the iframe to render; allow-popups needed to allow clicking. | ||
'src' => $matches['href'], | ||
], | ||
sprintf( '<a placeholder href="%s">Tumblr</a>', $url ) | ||
'overflow' => '', | ||
'tabindex' => 0, | ||
'role' => 'button', |
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 think we can rather use a button
here. Then we won't need the role
nor tabindex
attributes
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.
Done in 7df8bbe. Here's how it looks in Twenty Twenty with the button:
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.
Very good.
Oh, of course. It's because the embed was in the initial viewport. The problem is that the It needs some positioning to ensure it appears. It already has |
Co-authored-by: Weston Ruter <westonruter@google.com>
I just checked in Twenty Twenty One and the button on hover has a transparent background: button-background-tt1.movShould we consider this a theme bug? |
Also, for some reason I sometimes am seeing the button positioned outside the container making it invisible: It's strange because I didn't see it this way when testing a bit ago. But now I am. The issue is fixed for me via 3323625. |
It seems that is intentional as the button wasn't meant to be displayed over a dark background. I wonder if we should set a background color for the button as well. |
I tried setting white as the background of the button without success: white-background-on-light-mode.movwhite-background-on-dark-mode.movI guess we'd have to set the color on a wrapper element instead? Or add a |
], | ||
sprintf( '<a placeholder href="%s">Tumblr</a>', $url ) | ||
'overflow' => '', | ||
'style' => 'bottom:0', |
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 suppose this might as well be moved to amp-default.css
via this new rule:
button[overflow] {
bottom: 0;
}
This will have low specificity which will allow it to be easily overridden by themes/plugins.
'style' => 'bottom:0', |
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.
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.
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.
Hmm, OK it won't hurt to add it as a rule in amp-default.css
then.
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.
In the Jetpack plugin, there is an overflow button defined:
But I don't see any styling for it: https://github.com/Automattic/jetpack/blob/26db3e436ccca3e16a62d02d95e792a81f38a1e4/projects/plugins/jetpack/extensions/blocks/eventbrite/style.scss
😕
In the overflow example on amp.dev, the positioning defaults to top:0
: https://amp.dev/documentation/components/amp-list/#specifying-an-overflow
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.
Doesn't it already have position: absolute
from AMP?
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.
Yes but that specific rule does not apply for me all the time, which is weird.
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.
My bad, I was using a modified version of ampshared.css
. So all that needs to be set as you mentioned earlier is:
button[overflow] {
bottom: 0;
}
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.
Very good. Make it so.
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.
Filed Optimizer issue upstream: ampproject/amp-toolbox#1155.
Co-authored-by: Weston Ruter <westonruter@google.com>
…ntytwentyone_styles
Summary
Fixes #4757
Changes are adapted from 21ae657.
Checklist