Skip to content

Commit

Permalink
Fix Paragraph appender layout shift (building on 66061) (#66779)
Browse files Browse the repository at this point in the history
* Style to prevent Layout shift when placeholder is clicked

* Refactor style placement to target block-appender__content specifically

* Remove no longer needed rules

---------

Co-authored-by: Vrishabhsk <[email protected]>
Co-authored-by: andrewserong <[email protected]>
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
6 people authored and gutenbergplugin committed Nov 6, 2024
1 parent b7fe267 commit d9b166a
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,11 @@
.block-editor-default-block-appender__content {
// Set the opacity of the initial block appender to the same as placeholder text in an empty Paragraph block.
opacity: 0.62;
}

// In "constrained" layout containers, the first and last paragraphs have their margins zeroed out.
// In the case of this appender, it needs to apply those same rules to avoid layout shifts.
// Such shifts happen when the bottom margin of the Title block has been set to less than the default 1em margin of paragraphs.
:where(body .is-layout-constrained) &,
:where(.wp-site-blocks) & {
> :first-child {
margin-block-start: 0;
margin-block-end: 0;
}

// Since this appender will only ever appear on an entirely empty document, we don't account for last-child.
// This is also because it will never be the last child, the block inserter that sits in this appender is the last child.
// The following prevents user agent styles from applying margins to the appender's inner paragraph.
// This in turn prevents layout shift due to layout styles removing margins from first and last children.
margin-block-start: 0;
margin-block-end: 0;
}

// Dropzone.
Expand Down

0 comments on commit d9b166a

Please sign in to comment.