Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove no longer needed changes to block popover
  • Loading branch information
andrewserong committed Jan 4, 2023
commit 9c6367772995d55a28fb063c3216c6ef98470e0b
29 changes: 0 additions & 29 deletions packages/block-editor/src/components/block-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { useMergeRefs } from '@wordpress/compose';
import { getScrollContainer } from '@wordpress/dom';
import { Popover } from '@wordpress/components';
import {
forwardRef,
Expand Down Expand Up @@ -76,34 +75,6 @@ function BlockPopover(
};
}, [ selectedElement ] );

// Get the scrollable container that the block popover appears within.
const scrollContainer = useMemo( () => {
if ( ! __unstableContentRef?.current ) {
return;
}
return getScrollContainer( __unstableContentRef?.current );
}, [ __unstableContentRef?.current ] );

// Force the block popover to re-render whenever the content area is scrolled.
// This ensures that the position of the popover is accurate for fixed or sticky blocks.
useLayoutEffect( () => {
if ( ! scrollContainer ) {
return;
}

scrollContainer?.addEventListener?.(
'scroll',
forceRecomputePopoverDimensions
);

return () => {
scrollContainer?.removeEventHandler?.(
'scroll',
forceRecomputePopoverDimensions
);
};
}, [ scrollContainer ] );

const style = useMemo( () => {
if (
// popoverDimensionsRecomputeCounter is by definition always equal or greater
Expand Down