Skip to content

Commit

Permalink
Dropdown: use Popover s new anchor prop (#43698)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Sep 1, 2022
1 parent 190c31c commit 0556874
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/components/src/dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
Expand Down

0 comments on commit 0556874

Please sign in to comment.