Video embeds have no height in the editor

Created on 11 November 2023, 8 months ago
Updated 9 December 2023, 7 months ago

When embedding a video (youtube, viemo, etc) the video in editor has no height. on the front end it displays correctly.

it looks like its missing the 'wp-embed-responsive' class from the .editor-styles-wrapper container

I tried enabling responsive embeds in the mytheme.gutenberg.yml file with allowResponsive and enableResponsiveEmbeds, but im just guessing here. Im not sure what the correct setting (if there is one) is.

is there any documentation for what is available options are in the .yml file? or has anyone been able to embed youtube videos without any issues?

πŸ› Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States loze

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @loze
  • πŸ‡ΊπŸ‡ΈUnited States loze
  • Status changed to Postponed: needs info 7 months ago
  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    Can you provide more details about your installation? Drupal version, Gutenberg version, any other modules installed, what frontend theme you're using?

  • πŸ‡¬πŸ‡§United Kingdom Juc1

    I have the same problem in Drupal 10.1.6 / gutenberg 3.0.0-beta1 - youtube / soundcloud iframes render ok in /node/65 but in /node/65/edit they have height 0 and are therefore invisible in the gutenberg editor =

  • πŸ‡ΊπŸ‡ΈUnited States loze

    Yes, Im seeing exactly what Juc1 is describing. This happens regardless of which admin or frontend theme I am using.

  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    Some findings:

    • This happens when Media module is enabled. Embeds are processed differently on the editor when Media is enabled, it uses Media embed processor. Btw, when not enabled, it uses Iframe.ly service which, probably, we need to stop using. Related to πŸ’¬ Iframe.ly Active
    • Actually I never used the allowResponsive or enableResponsiveEmbeds settings but I don't think it will do any difference when using Media.
    • I've checked some of our projects and I noticed that frontend devs are adding this style to wp-block-embed (SCSS):
      figure.wp-embed-aspect-16-9 {
          aspect-ratio: 16 / 9;
      
          .wp-block-embed__wrapper {
              &, iframe {
                  height: 100%;
                  width: 100%;
              }
          }
      }
      

      It seems to do the trick.

  • Status changed to Needs work 7 months ago
  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    btw, you can add the above css to *.gutenberg.yml file like this:

    theme-support:
      styles:
        - css: |-
            figure.wp-embed-aspect-16-9 {
              aspect-ratio: 16 / 9;
            }
            figure.wp-embed-aspect-16-9 .wp-block-embed__wrapper {
              height: 100%;
              width: 100%;
            }
            figure.wp-embed-aspect-16-9 .wp-block-embed__wrapper iframe {
              height: 100%;
              width: 100%;
            }
    

    If want want to use libraries:

    libraries-edit:
      - your-theme/your-lib
    
Production build 0.69.0 2024