diff --git a/packages/widgets/src/blocks/legacy-widget/edit/form.js b/packages/widgets/src/blocks/legacy-widget/edit/form.js index 4bca14ab26ddb7..7677df1d054b2f 100644 --- a/packages/widgets/src/blocks/legacy-widget/edit/form.js +++ b/packages/widgets/src/blocks/legacy-widget/edit/form.js @@ -19,7 +19,7 @@ import { closeSmall } from '@wordpress/icons'; * Internal dependencies */ import Control from './control'; -import { useBudgeTopBy } from './utils'; +import { useAlignTopWithinViewport } from './utils'; export default function Form( { title, @@ -109,7 +109,7 @@ export default function Form( { if ( isWide ) { return ( - + { formCore } ); @@ -125,16 +125,19 @@ export default function Form( { ); } -function WideFormDialog( { isVisible, children } ) { - const containerRef = useRef(); - const [ dialogRef, dialogProps ] = useDialog( { focusOnMount: false } ); +function WideFormDialog( { isVisible, onClose, children } ) { + const ref = useRef(); + const [ dialogRef, dialogProps ] = useDialog( { + focusOnMount: false, + onClose, + } ); const { - ref: budgeRef, + ref: alignTopRef, resizeObserver, - } = useBudgeTopBy( containerRef.current, { isEnabled: isVisible } ); + } = useAlignTopWithinViewport( ref.current, { isEnabled: isVisible } ); return (