From a198bd2b61cf452d10df2fa9fc2ef76ab5fc7de9 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Thu, 24 Oct 2024 19:33:52 -0700 Subject: [PATCH] Revise zoom layout shift fix (#66390) * Contain margins with BFC instead of border * Move to block canvas styles in the visual editor --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: stokesman Co-authored-by: andrewserong Co-authored-by: ramonjd Co-authored-by: t-hamano --- packages/block-editor/src/components/iframe/content.scss | 1 - packages/editor/src/components/visual-editor/index.js | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/iframe/content.scss b/packages/block-editor/src/components/iframe/content.scss index 1d01f84b5fd1fd..596c177eab2f32 100644 --- a/packages/block-editor/src/components/iframe/content.scss +++ b/packages/block-editor/src/components/iframe/content.scss @@ -1,6 +1,5 @@ .block-editor-iframe__body { position: relative; - border: 0.01px solid transparent; } .block-editor-iframe__html { diff --git a/packages/editor/src/components/visual-editor/index.js b/packages/editor/src/components/visual-editor/index.js index 133057d9f388f1..1c8eb5c3b77640 100644 --- a/packages/editor/src/components/visual-editor/index.js +++ b/packages/editor/src/components/visual-editor/index.js @@ -356,7 +356,10 @@ function VisualEditor( { return [ ...( styles ?? [] ), { - css: `.is-root-container{display:flow-root;${ + // Ensures margins of children are contained so that the body background paints behind them. + // Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s + // important mostly for post-only views yet conceivably an issue in templated views too. + css: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${ // Some themes will have `min-height: 100vh` for the root container, // which isn't a requirement in auto resize mode. enableResizing ? 'min-height:0!important;' : ''