From 58c5068bda2967c663202d955e65b7420db03b01 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 10 Dec 2024 14:02:17 +0100 Subject: [PATCH] Fix Chromium showing scrollbar on embedded posts (#33237) --- app/javascript/entrypoints/embed.tsx | 4 ++++ app/javascript/styles/mastodon/basics.scss | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/javascript/entrypoints/embed.tsx b/app/javascript/entrypoints/embed.tsx index f8c824d287a..cb627275633 100644 --- a/app/javascript/entrypoints/embed.tsx +++ b/app/javascript/entrypoints/embed.tsx @@ -60,6 +60,10 @@ window.addEventListener('message', (e) => { const data = e.data; + // Only set overflow to `hidden` once we got the expected `message` so the post can still be scrolled if + // embedded without parent Javascript support + document.body.style.overflow = 'hidden'; + // We use a timeout to allow for the React page to render before calculating the height afterInitialRender(() => { window.parent.postMessage( diff --git a/app/javascript/styles/mastodon/basics.scss b/app/javascript/styles/mastodon/basics.scss index 1a74d8d52d3..ec6e4d0a9a2 100644 --- a/app/javascript/styles/mastodon/basics.scss +++ b/app/javascript/styles/mastodon/basics.scss @@ -107,13 +107,7 @@ body { &.embed { margin: 0; padding-bottom: 0; - - .container { - position: absolute; - width: 100%; - height: 100%; - overflow: hidden; - } + overflow: hidden; } &.admin {