Skip to content

Commit 55dc3de

Browse files
committed
Better check for the edit form ref, which exist only when isEditing.
1 parent b587a43 commit 55dc3de

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

core-blocks/block/edit-panel/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ class SharedBlockEditPanel extends Component {
3838
}
3939

4040
handleClickOutside( event ) {
41-
if ( ! this.editForm.current ) {
42-
return;
43-
}
44-
45-
if ( ! this.editForm.current.contains( event.target ) ) {
41+
// The form is rendered only when isEditing.
42+
if ( this.props.isEditing && ! this.editForm.current.contains( event.target ) ) {
4643
this.props.onCancel();
4744
}
4845
}

0 commit comments

Comments
 (0)