-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Giant space above all Youtube video in Posts #10109
Comments
Thanks for reporting the bug, agreed that does not look right, and I'd imagine frustrating. I see the whitespace when I visit your site, however I'm not able to reproduce it. I installed the Hueman Free theme, and using the Autooptimize plugin, which I noticed are what you use on your site at: https://www.discerningtheworld.com/ When I create a post with a YouTube embed, I'm not able to get the large space. To help anyone else when troubleshooting: I noticed on your embed there is an additional classname Code in: Can you let me know how you added the embed, and if there is anything you did after adding the embed to help reproduce and solve the issue? |
Hi mkaz Yes I saw that "wp-embed-aspect-4-3" in the CSS and because I am not a programmer at all, I had no idea if this should be there or not. So I will remove it and come back to you. I added the embed video, by adding a block, then clicking Youtube and only adding the youtube video url nothing else, just the plain url to the video. Everything was working fine till the latest version upgrade. |
Hi mkaz Ahhhhh Ha! "wp-embed-aspect-4-3" is indeed the culprit, I removed it and the giant space is gone. But now the big question, where is this additional CSS coming from ? It was not there yesterday. All was hunky dory until I updated to new version of Gutenberg last night. I see on other posts it's added additional CSS "wp-has-aspect-ratio wp-embed-aspect-16-9". And it too is making a big white space above all my videos. What do you suggest I do? I can't sit and manually go through 600 articles removing this CSS that's appeared out of nowhere. Help. |
ok, good to see we were able to narrow it down. Will need to investigate further to see what it was trying to address and figure out a solution. |
You got me thinking. I deactivated the Autoptimize plugin and taaadaaaa.... problem resolved. I will play around with the settings and see if I can get Autoptimize to work without breaking my site... Do you recommend another plugin similar to Autoptimize? |
In the meantime of having the plugin deactivated, you should report that problem to the developers of Autoptimize: https://wordpress.org/plugins/autoptimize/#developers |
Thank you Marcus. I have contacted Autoptimiae support here: https://wordpress.org/support/topic/giant-space-above-all-youtube-video-when-viewing-posts-in-gutenberg-v-3-9-0/ |
Heya everyone; I actually still see the gap even with AO disabled, cfr. this screenshot; There's a Happy hunting! |
Goodgrief, the error is back... I'm now confused... Never the less... Frank you are a superstar!!!! 🥇 |
Thanks for jumping in and looking @futtta - agreed, I don't think it is a conflict with Autoptimize. To help troubleshoot: @Pikkals what steps did you do when adding the YouTube embed? It looks like older posts do not have that same issue with embeds, likely because they were not created in Gutenberg. Can you try to delete and add the YouTube block again in that post? For @notnownikki and @jasmussen who worked on the issue: It looks like an unintended consequence from this PR #9770 in 3.9.0 the iframe width/height is being detected properly and the additional aspect ratio class is added, however, when the new class is added it includes a large padding at the top. It looks like the styles in #9550 are what is causing the issue here, but I'm not able to reproduce in my tests when adding a block, using same theme as user. |
Hi all - I took a look at this and I think this may be a plugin conflict although I don't believe it's Autoptimize in this case. When I insert a YouTube embed on my own site, I see this HTML rendered out: <figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-has-aspect-ratio wp-embed-aspect-16-9">
<div class="wp-block-embed__wrapper">
<iframe width="660" height="371" src="https://www.youtube.com/embed/GLwz5IJ4AsY?feature=oembed" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe>
</div>
</figure> However when I look at a YouTube embed on your site, I see the following: <figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-has-aspect-ratio wp-embed-aspect-4-3">
<div class="wp-block-embed__wrapper">
<div class="video-container">
<span class="embed-youtube" style="text-align:center; display: block;">
<iframe class="youtube-player" type="text/html" width="640" height="360" src="https://www.youtube.com/embed/Bp00Wh-oaOQ?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&start=108&wmode=transparent" allowfullscreen="true" style="border:0;"></iframe>
</span>
</div>
</div>
</figure> Note all the extra @Pikkals could you provide a list of plugins on your site? I would guess that another plugin is attempting to handle the responsive video, and is colliding with the way Gutenberg handles it. |
Hi, Same problem on my blog with Hueman free theme. I don't use any editor plugin (could other kind of plugins be involved ?). See for example at the bottom of that post modified with Gutenberg 3.9.0 today : http://jeanneavelo.fr/2018/02/22/un-carrefour-urbain-ordinaire-aux-pays-bas/ Older posts (i.e. not edited with Gutenbegrg 3.9.0) are not concerned. |
Sounds then like it's an issue with the Hueman Free theme in particular then. Perhaps worth reaching out to the theme developer about this. Also possibly worth looking at whether this should be another opt-in theme feature via |
Hi guys I am using the Hueman Pro theme. I will contact the developer and send them here to have a look. And yes you are right Jeanneavelo posts that have not been edited with Gutenberg are fine. Ok, I have logged a ticket with Hueman support. |
Hi chrisvanpatten Here is a list of all my plugins: THEME | VERSION : Hueman Pro | v1.1.3 |
Good ticket, thank you. So this issue happens because embeds created in Gutenberg are now responsive out of the box. The issue here is that if the theme itself also provides responsiveness for embeds through filtering the output, you end up with a double fix, which makes this extra space appear. There are a number of ways to fix this, @chrisvanpatten I would appreciate your thoughts here as well. Option 1: Move the responsive Gutenblock CSS from Option 2: We make it a user toggle, so a user can toggle the responsiveness off on a per-embed basis, if we default to On. Option 3: Here's some CSS that seems to fix it in the case of THIS particular theme:
But this is a little hacky because it assumes a particular way of adding responsiveness to the videos. What do you think? CC: @mtias |
Hmmmm I see I have a plugin called - WP Edit (version 4.0.3) installed, I am going to deactivate this and see what happens. Ok, I see I still have the problem. I'll keep this plugin deactivated as I don't see the need for it. |
I had this on my list to suggest too, thinking of wider themes and narrower videos where it might not look that great. |
This PR fixes #10109. But it does so in a semi-nuclear way, by removing the responsiveness by default, and making it something a theme author has to opt into by opting into Gutenberg "opinionated" styles. This might be the solution we go with, hence this PR, but I would love for us to consider it a "Plan B" while we explore better solutions.
|
I logged my ticket with [email protected] and asked the developers to please come to this thread. |
As much as it disappoints me, I think we might have to make this opt in. Or, perhaps we make responsive videos opt-in (or out?) at the document level instead of the block level? |
This PR makes it opt-in through the block styles. But I agree, I would consider that our last option, because I sort of feel a responsibility for Gutenberg to provide responsive features by default, so let's make sure we have a fix in the 4.0, but let's keep thinking of ways to do this without making it opt-in. Presumably themes which provide their own responsiveness do so with a filter that adds additional wrapping elements and classes, no? Would it be possible/feasible/not break things, if we apply a differently named filter for responsive videos? |
Oh... wonderful :( so if providers are sometimes doing their own responsive thing, then we need to detect when that's happening and turn of the gutenberg responsive styles for that embed. I guess we could parse the html and see if any of the elements have a relative position applied...? @gregsullivan thank you for spotting this! |
You're welcome, @notnownikki! It occurred to me that this could be happening on three levels on the oEmbed side:
I started to wonder whether it might make sense to use JavaScript to check for and remove responsive styling on elements descending from Definitely not an easy problem to solve! |
Indeed! So the way I'd probably approach this is when we receive a new bunch of preview HTML, set state that says we're checking it for provider supplied responsiveness, and not render the preview until that check is complete. Then we parse the HTML and walk the DOM looking for provider supplied responsiveness (or maybe we render into an iframe and watch DOM changes to see what's going on... perhaps for the first iteration we just parse the HTML and walk the DOM). Once we've done that, we know if we need to disable responsiveness for that embed block or not, we set the state to say "reponsiveness checked" and then the preview would render without any flashing. |
That makes sense to me! Do you see an approach that would prevent issues on the front-end if oEmbed providers were to change the HTML they provide (either by starting as non-responsive and becoming responsive, or vice versa)? |
Oh golly.
So — embed providers sometimes also change their icons, and given we include icons that means we also need to update them. This is one of the challenges we more or less took on our shoulders when deciding to have explicit separate embed providers on a whitelist, rather than be more generic in the approach. In that vein, if we were able to auto-detect this stuff, that would be swell. But if that's not possible, would it make sense to simply create a list instead of embed providers that provide their own responsiveness, and omit those from the block editor treatment? |
We'd have to include the same detection on the front end that we do on the backend. I'm not sure we want to do that, or even if it's a good idea. We could end up with race conditions and scripts fighting each other, which in the editor is kinda... yucky not not site breaking. On the front end though, unacceptable.
There might be some clever CSS way we can override the responsive padding from the provider and only have ours take effect? That's a question for you really @jasmussen but my feeling is that we might end up breaking more things without realising it if we go down that route. If the providers are starting to include their own responsiveness, then yes this seems the way to go. I'm not sure why some videos get it and some dont when the videos come from the same provider - it could be some kind of A/B test going on? But if that's the way they're moving, then yeah, just register the blocks with |
I had the same thought back when we were hoping to be able to roll this out without opt in. And I did get it to work, for one such method. But the problem is there are a number of different ways the responsiveness can be built, and unfortunately if I were to have to target them all, it would very likely touch selectors and elements it shouldn't. So I'm not so confident in that approach anymore, unfortunately. I think you may be right, it could be an A/B test, or it could even be a thing that happens only for new embeds or something in that vein. Perhaps an interim solution is to update the help text here to explain cases where you might want to turn it off? |
One further note here: Vimeo seems to be breaking the oEmbed spec with these styles. Here's what oEmbed has to say about the
(Emphasis mine.) I've asked my client for access to their Vimeo account; maybe I'll be able to get a sense of what is triggering the responsive styles on some videos and not others. I know it's not new versus old, as it happened in very recent videos as well as videos more than three years old. |
Between Vimeo's documentation and access to my client's account, I think I have a decent handle on the cause of the variation between videos. Vimeo's embed code documentation has a "Responsive embeds" section that says the following:
So if you're getting the embed code manually, responsive code is triggered by choosing between "Responsive" and "Fixed Size" in the "Share this Video" overlay. The documentation also says that use of Vimeo Cards causes the embed always to be responsive. This isn't a problem I ran into, but I could see it being an issue for others. Vimeo's oEmbed documentation says the default is for a non-responsive embed, but also says:
My client has a Vimeo Pro account. In their account, the videos set to "No preset" had the responsive styles added, whereas their custom preset sets a size of 640 × 360. They occasionally forget to select the preset, and it's those videos that had the responsive styles and corresponding empty space above them. In conclusion: Videos hosted by Vimeo Pro accounts without fixed sizes set for their embed (and videos using Vimeo Cards) will always send responsive styles when requested via oEmbed. I'm not sure how feasible this is, but perhaps having <iframe src="https://player.vimeo.com/video/${video_id}" width="${width}" height="${height}" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> |
Thanks for the superb investigation, this is exceptionally helpful.
There is perhaps a larger question around the UX for responsive embeds, given that technically any oembed provider could change their markup at will. The fact that responsive embeds in the block editor are opt-in, and you can opt out on a per embed basis, is a good start. But I'm wondering what the best next steps are.
@gregsullivan question: does the embed look broken both in the frontend and in the editor? Or just the frontend? If it's in both places, the block toggle on the block itself might be a good UX change because you'd be able to toggle it on and off easily and see the effect instantly. |
@jasmussen The embed looks normal in the editor for all the videos I've tested, so it's purely a front-end problem for me. On the one hand, I agree 100% with the whack-a-mole characterization. On the other hand, I'm curious whether services implementing oEmbed would tend to see the padding change causing the problem as breaking the spec, making the problem rarer. |
One further possibility: Is there a willingness to rewrite the CSS responsible for responsive embeds? I took a go at it and made a version that works for both styles of Vimeo output. If you think this is worth pursuing, I could test it across more embeds to ensure compatibility and then share it with you. It requires some use of |
Better CSS is absolutely an option, and I would suggest that !important was created for use cases like this. Depending on the solution you have in mind I can't know for sure whether it'll work, but I'd be excited to see your solution! Thanks again. |
Sounds good! I'll update you when I have something further along to show you. A related question: Are the embeds meant to support 9:16, 9:6 or both? If 9:6, I think there's a typo here:
If 9:16, I think this would need to be changed: gutenberg/packages/block-library/src/embed/style.scss Lines 66 to 68 in 429558a
Based on the order, it looks like lines 66–68 should actually be: &.wp-embed-aspect-9-16 .wp-block-embed__wrapper::before {
padding-top: 177.77%; // 16 / 9 * 100
} (All of the Sorry if this should be a separate issue! Let me know if you think it makes sense to do a pull request just for this. |
It's very possible there's a typo there. And yes, feel free to open a ticket if you like, you can reference this one and CC me (@jasmussen) and I'll follow it along. I'm going in vacation now, though, so I may not be able to test your code, but I'll certainly be able to ping someone who can. |
Great, thanks! I went ahead and did a pull request for the aspect ratio typo: #16573 Enjoy your vacation! |
Hi @jasmussen @gregsullivan unfortunately my website seems to also have probems with white spacing. I'm using Sydney theme along with Visual composer. Everything is up to date, but after the Gutenberg change I just can't seem to remove it. The CSS code you provided, doesn't seem to work for me. Hope you can help me out: |
@jessejoeyjames The CSS above is specific to WordPress's built-in block editor. You appear to be encountering a conflict between Visual Composer and FitVids.js. You'd have to figure out which plugin or theme is including the latter to resolve the conflict. |
@gregsullivan Thank you for replying so quickly. I have no idea how you found that out so quickly, but I searched for Fitvids in cobination with my SydneyTheme. And the theme indeed seems to be using Fitvids.js Am I supposed to contact Sydney theme or can i simply remove fitvids myself? EDIT:
Please let me know if this is okay, I'm assumming there should be a proper fix. I'm only a very average coder with just basic php,css,html knowledge. But I just tested this out as a combination of @jasmussen 's code and the conflicting area you pointed out. |
@jessejoeyjames I'd suggest contacting your theme's developers and asking if there's a way to disable FitVids.js, either using a setting or a filter. Since you're going to continue using Visual Composer, it would be better to remove FitVids.js as one half of the doubled responsive embed styles. The theme's developers should be able to help, though—good luck! |
@jasmussen @notnownikki I have another (potentially final) update on this, as my sense is that this is even more of an edge case than I initially thought. In order to test potential CSS fixes, I added a hook to In doing so, I found that the preexisting checks below successfully prevent the embed from being flagged as responsive: gutenberg/packages/block-library/src/embed/util.js Lines 152 to 168 in 62439f0
(Vimeo's responsive embed removes the width and height from its So in order for the double-responsive issue to occur in this case, the embed needs to change over time, outputting the responsive version after initially outputting the non-responsive version. I did find that a minor revision to the embed CSS would solve the problem and work both for existing embeds and the responsive Vimeo embed, but I don't know that it warrants a pull request given that it's relatively difficult to trigger the issue. I suppose an argument in favour of the change would be that someone could add the responsive classes to a responsive Vimeo embed that initially loaded without them, and they would work without triggering double-responsiveness. |
Hi! Are there any news on this? I also reported to my theme (DIVI) the issue to see if they should do something. I add some snapshots as example. |
This problem still exist, I have an updated WP, and today 07.11.19 I have this issue on my site. |
I had the same problem, from the Youtube Free plugin. Youtube settings > defaults > Unselecting "responsive video sizing" fixed the issue. Its looks like it adds a fluid-width-video-wrapper with a huge amount of padding when ticked. (It might conflict with some theme or plugin styles applied elsewhere.) |
Fitvids has an option to exclude certain css classes.
If you remove it completely then videos embedded elsewhere may no longer be responsive. |
I'm seeing this same problem using OceanWP theme and Vimeo links. |
Describe the bug
Giant space above all Youtube video when VIEWING Posts in Gutenberg: Version 3.9.0
To Reproduce
Steps to reproduce the behavior:
Expected behavior
There should be reasonable space around the Youtuve video.
Screenshots
Desktop (please complete the following information):
Additional context
Latest version of Gutenberg: Version 3.9.0
The text was updated successfully, but these errors were encountered: