Skip to content

Commit

Permalink
Fix Cover block ref usage (#29354)
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman authored Feb 26, 2021
1 parent 628d854 commit 8e43c3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ function CoverEdit( {
const imperativeFocalPointPreview = ( value ) => {
const [ styleOfRef, property ] = isDarkElement.current
? [ isDarkElement.current.style, 'objectPosition' ]
: [ blockProps.ref.current.style, 'backgroundPosition' ];
: [ ref.current.style, 'backgroundPosition' ];
styleOfRef[ property ] = mediaPosition( value );
};

Expand Down Expand Up @@ -494,7 +494,8 @@ function CoverEdit( {
</>
);

const blockProps = useBlockProps();
const ref = useRef();
const blockProps = useBlockProps( { ref } );
const innerBlocksProps = useInnerBlocksProps(
{
className: 'wp-block-cover__inner-container',
Expand Down

0 comments on commit 8e43c3a

Please sign in to comment.