Skip to content

Commit

Permalink
Fix image layout shift from placeholder to selected placeholder (#59857)
Browse files Browse the repository at this point in the history
* Fix image layout shift from placeholder to selected placeholder

* Only when not selected.

* Update changelog.
  • Loading branch information
jasmussen authored Mar 14, 2024
1 parent ee70b1c commit eabd972
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 0 additions & 5 deletions packages/block-library/src/image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
// @todo: this particular minimal style of placeholder could be componentized further.
.wp-block-image.wp-block-image {

&:not(.is-selected) .components-placeholder__fieldset {
// Show only is selected.
display: none;
}

// Show Placeholder style on-select.
&.is-selected .components-placeholder {
// Block UI appearance.
Expand Down
3 changes: 2 additions & 1 deletion packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## Unreleased
- `Drowdown` : Add styling support for `MenuGroup` ([#59723](https://github.com/WordPress/gutenberg/pull/59723)).
- `Dropdown` : Add styling support for `MenuGroup` ([#59723](https://github.com/WordPress/gutenberg/pull/59723)).
- `Placeholder` : Allow overflow but only when placeholder is selected, to fix a layout shift. `MenuGroup` ([#59857](https://github.com/WordPress/gutenberg/pull/59857)).

### Enhancements

Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/placeholder/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@

// By painting the borders here, we enable them to be replaced by the Border control.
@include placeholder-style();
overflow: auto;

overflow: hidden;
.is-selected & {
overflow: auto;
}
}

// Position the spinner.
Expand Down

0 comments on commit eabd972

Please sign in to comment.