Skip to content

Commit

Permalink
Fix unrecognised forwardedRef prop error
Browse files Browse the repository at this point in the history
Have `withGlobalEvents` omit the `forwardedRef` prop. This prevents the
prop being added to HTML in some cases, e.g. when used in
`FocusableIframe`.
  • Loading branch information
noisysocks committed Aug 6, 2018
1 parent 831e328 commit 9078205
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/compose/src/with-global-events/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { forEach } from 'lodash';
import { forEach, omit } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -61,7 +61,12 @@ function withGlobalEvents( eventTypesToHandlers ) {
}

render() {
return <WrappedComponent { ...this.props } ref={ this.handleRef } />;
return (
<WrappedComponent
{ ...omit( this.props, [ 'forwardedRef' ] ) }
ref={ this.handleRef }
/>
);
}
}

Expand Down

0 comments on commit 9078205

Please sign in to comment.