From c81f322f4938a4c81a30e5f462622a6a6d43e4c5 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Mon, 14 Aug 2023 21:08:10 -0700 Subject: [PATCH] Fix support of sticky position in non-iframed post editor (#53540) * Fix support of sticky position in non-iframed post editor --- .../src/components/visual-editor/index.js | 17 +++++++++-------- .../src/components/visual-editor/style.scss | 6 +++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index 29e6e15da4579f..c48282e12651c2 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -338,11 +338,19 @@ export default function VisualEditor( { styles } ) { .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; + const isToBeIframed = + ( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) && + ! hasMetaBoxes ) || + isTemplateMode || + deviceType === 'Tablet' || + deviceType === 'Mobile'; + return ( @@ -359,14 +367,7 @@ export default function VisualEditor( { styles } ) { className={ previewMode } > diff --git a/packages/edit-post/src/components/visual-editor/style.scss b/packages/edit-post/src/components/visual-editor/style.scss index 00678f9867ec3c..fa61cc9889cf9c 100644 --- a/packages/edit-post/src/components/visual-editor/style.scss +++ b/packages/edit-post/src/components/visual-editor/style.scss @@ -2,7 +2,11 @@ position: relative; display: flex; flex-flow: column; - overflow: hidden; + // In the iframed canvas this keeps extra scrollbars from appearing (when block toolbars overflow). In the + // legacy (non-iframed) canvas, overflow must not be hidden in order to maintain support for sticky positioning. + &:not(.has-inline-canvas) { + overflow: hidden; + } // Gray preview overlay (desktop/tablet/mobile) is intentionally not set on an element with scrolling content like // interface-interface-skeleton__content. This causes graphical glitches (flashes of the background color)