From e2a36587999b0e6e2e72a7ad39ba846939446ade Mon Sep 17 00:00:00 2001 From: Colin Stewart <79332690+costdev@users.noreply.github.com> Date: Tue, 30 Nov 2021 02:14:22 +0000 Subject: [PATCH] Add CSS fix. (#36759) --- .../src/blocks/legacy-widget/index.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/widgets/src/blocks/legacy-widget/index.php b/packages/widgets/src/blocks/legacy-widget/index.php index e827f8f7c5309..0d4e733d4cb36 100644 --- a/packages/widgets/src/blocks/legacy-widget/index.php +++ b/packages/widgets/src/blocks/legacy-widget/index.php @@ -108,6 +108,33 @@ function handle_legacy_widget_preview_iframe() { padding: 0 !important; margin: 0 !important; } + + /* Hide root level text nodes */ + body { + font-size: 0 !important; + } + + /* Hide non-widget elements */ + body *:not(#page):not(#content):not(.widget):not(.widget *) { + display: none !important; + font-size: 0 !important; + height: 0 !important; + left: -9999px !important; + max-height: 0 !important; + max-width: 0 !important; + opacity: 0 !important; + pointer-events: none !important; + position: absolute !important; + top: -9999px !important; + transform: translate(-9999px, -9999px) !important; + visibility: hidden !important; + z-index: -999 !important; + } + + /* Restore widget font-size */ + .widget { + font-size: var(--global--font-size-base); + } >