Skip to content

Commit

Permalink
Components: Persist withFocusOutside event for async usage
Browse files Browse the repository at this point in the history
isBlurring instance variable was never used
  • Loading branch information
aduth committed Nov 30, 2017
1 parent 467f044 commit 1efbb9f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/higher-order/with-focus-outside/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ function withFocusOutside( WrappedComponent ) {
}

queueBlurCheck( event ) {
this.isBlurring = true;
// React does not allow using an event reference asynchronously
// due to recycling behavior, except when explicitly persisted.
event.persist();

this.blurCheckTimeout = setTimeout( () => {
if ( 'function' === typeof this.node.handleFocusOutside ) {
this.node.handleFocusOutside( event );
Expand All @@ -36,7 +39,6 @@ function withFocusOutside( WrappedComponent ) {
}

cancelBlurCheck() {
delete this.isBlurring;
clearTimeout( this.blurCheckTimeout );
}

Expand Down

0 comments on commit 1efbb9f

Please sign in to comment.