Skip to content

Commit

Permalink
Better check for the edit form ref, which exist only when isEditing.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Apr 30, 2018
1 parent e8de48e commit 36ffa4c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions core-blocks/block/edit-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ class SharedBlockEditPanel extends Component {
}

handleClickOutside( event ) {
if ( ! this.editForm.current ) {
return;
}

if ( ! this.editForm.current.contains( event.target ) ) {
// The form is rendered only when isEditing.
if ( this.props.isEditing && ! this.editForm.current.contains( event.target ) ) {
this.props.onCancel();
}
}
Expand Down

0 comments on commit 36ffa4c

Please sign in to comment.