Skip to content

Commit

Permalink
Fix handles becoming sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed May 9, 2024
1 parent 84f1cb7 commit 7e4dbb8
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ export function GridItemResizer( { clientId, onChange } ) {
* so that it resizes in the right direction.
*/
setResizeDirection( direction );

/*
* The mouseup event on the resize handle doesn't trigger if the mouse
* isn't directly above the handle, so we try to detect if it happens
* outside the grid and dispatch a mouseup event on the handle.
*/
const rootElementParent = rootBlockElement.parentElement;
rootElementParent.addEventListener(
'mouseup',
() => {
event.target.dispatchEvent(
new Event( 'mouseup', { bubbles: true } )
);
},
true
);
} }
onResizeStop={ ( event, direction, boxElement ) => {
const gridElement = blockElement.parentElement;
Expand Down

0 comments on commit 7e4dbb8

Please sign in to comment.