diff --git a/packages/components/src/dropdown/index.js b/packages/components/src/dropdown/index.js index c260d27ffee7df..2ec44fb5d907ba 100644 --- a/packages/components/src/dropdown/index.js +++ b/packages/components/src/dropdown/index.js @@ -83,7 +83,10 @@ export default function Dropdown( props ) { } const args = { isOpen, onToggle: toggle, onClose: close }; - const hasAnchorRef = + const hasPopoverAnchor = + !! popoverProps?.anchor || + // Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and + // be removed from `Popover` from WordPress 6.3 !! popoverProps?.anchorRef || !! popoverProps?.getAnchorRect || !! popoverProps?.anchorRect; @@ -110,7 +113,9 @@ export default function Dropdown( props ) { // This value is used to ensure that the dropdowns // align with the editor header by default. offset={ 13 } - anchorRef={ ! hasAnchorRef ? containerRef : undefined } + anchor={ + ! hasPopoverAnchor ? containerRef.current : undefined + } { ...popoverProps } className={ classnames( 'components-dropdown__content',