diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md index 827b9f2e2211e4..a6fb9984fd553f 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -6,6 +6,7 @@ - `FontSizePicker`: Update fluid utils so that only string, floats and integers are treated as valid font sizes for the purposes of fluid typography ([#44847](https://github.com/WordPress/gutenberg/pull/44847)) - `getTypographyClassesAndStyles()`: Ensure that font sizes are transformed into fluid values if fluid typography is activated ([#44852](https://github.com/WordPress/gutenberg/pull/44852)) +- `BlockPopover`: Ensure that padding and margin visualizers display in correct position even when scrolling past block. ([#44998](https://github.com/WordPress/gutenberg/pull/44998)) ### New features diff --git a/packages/block-editor/src/components/block-popover/README.md b/packages/block-editor/src/components/block-popover/README.md index 379eb561a0262a..c60da7a982ae87 100644 --- a/packages/block-editor/src/components/block-popover/README.md +++ b/packages/block-editor/src/components/block-popover/README.md @@ -22,6 +22,14 @@ The client ID of the block representing the bottom position of the popover. - Type: `String` - Required: No +#### shift + +This determines whether the block popover always shifts into the viewport or remains at its original position. See FloatingUI for more details on shift. + +- Type: `Boolean` +- Required: No +- Default: `true` + ## BlockPopoverInbetween ### Props diff --git a/packages/block-editor/src/components/block-popover/index.js b/packages/block-editor/src/components/block-popover/index.js index 36a4017c226c07..4cd29a99be62ad 100644 --- a/packages/block-editor/src/components/block-popover/index.js +++ b/packages/block-editor/src/components/block-popover/index.js @@ -32,6 +32,7 @@ function BlockPopover( __unstableCoverTarget = false, __unstablePopoverSlot, __unstableContentRef, + shift = true, ...props }, ref @@ -166,7 +167,7 @@ function BlockPopover( placement="top-start" resize={ false } flip={ false } - shift + shift={ shift } { ...props } className={ classnames( 'block-editor-block-popover', diff --git a/packages/block-editor/src/hooks/margin.js b/packages/block-editor/src/hooks/margin.js index b54374295ace0c..0e60717486d2bc 100644 --- a/packages/block-editor/src/hooks/margin.js +++ b/packages/block-editor/src/hooks/margin.js @@ -231,6 +231,7 @@ export function MarginVisualizer( { clientId, attributes } ) { clientId={ clientId } __unstableCoverTarget __unstableRefreshSize={ margin } + shift={ false } >
diff --git a/packages/block-editor/src/hooks/padding.js b/packages/block-editor/src/hooks/padding.js index 22cb8f9e766758..46015b1e164631 100644 --- a/packages/block-editor/src/hooks/padding.js +++ b/packages/block-editor/src/hooks/padding.js @@ -222,6 +222,7 @@ export function PaddingVisualizer( { clientId, attributes } ) { clientId={ clientId } __unstableCoverTarget __unstableRefreshSize={ padding } + shift={ false } >