Skip to content

A platform for community discussion. Free, open, simple.

UX: Make YouTube playlist onebox full width to match video onebox (#16936)

David Taylor8fe39348569c
diff --git a/app/assets/stylesheets/common/base/onebox.scss b/app/assets/stylesheets/common/base/onebox.scss
index 3d7e95daa4d..87974b636c1 100644
--- a/app/assets/stylesheets/common/base/onebox.scss
+++ b/app/assets/stylesheets/common/base/onebox.scss
@@ -823,6 +823,16 @@ aside.onebox.xkcd .onebox-body img {
@extend .imgur-album;
}
+@supports (aspect-ratio: 1) {
+ // Not supported on iOS < 15. For those devices, we just
+ // use the fixed width/height attributes on the iframe
+ .youtube-onebox {
+ width: 100%;
+ height: auto;
+ aspect-ratio: 16/9;
+ }
+}
+
// Force oneboxed videos to 16:9 aspect ratio
.onebox.video-onebox,
.video-container {
diff --git a/lib/onebox/engine/youtube_onebox.rb b/lib/onebox/engine/youtube_onebox.rb
index 237a29e81b2..eaa1496f2d9 100644
--- a/lib/onebox/engine/youtube_onebox.rb
+++ b/lib/onebox/engine/youtube_onebox.rb
@@ -57,6 +57,7 @@ module Onebox
height="#{HEIGHT}"
frameborder="0"
allowfullscreen
+ class="youtube-onebox"
></iframe>
HTML
elsif list_id
@@ -67,6 +68,7 @@ module Onebox
height="#{HEIGHT}"
frameborder="0"
allowfullscreen
+ class="youtube-onebox"
></iframe>
HTML
else