-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Components: Add onFocusOutside alternative to Popover onClickOutside
- Loading branch information
Showing
8 changed files
with
85 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ | |
'wp-a11y', | ||
'wp-api-fetch', | ||
'wp-compose', | ||
'wp-deprecated', | ||
'wp-dom', | ||
'wp-element', | ||
'wp-hooks', | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
/** | ||
* External dependencies | ||
* WordPress dependencies | ||
*/ | ||
import clickOutside from 'react-click-outside'; | ||
import { Component } from '@wordpress/element'; | ||
|
||
/** | ||
* WordPress dependencies | ||
* Internal dependencies | ||
*/ | ||
import { Component } from '@wordpress/element'; | ||
import withFocusOutside from '../higher-order/with-focus-outside'; | ||
|
||
class PopoverDetectOutside extends Component { | ||
handleClickOutside( event ) { | ||
const { onClickOutside } = this.props; | ||
if ( onClickOutside ) { | ||
onClickOutside( event ); | ||
} | ||
handleFocusOutside( event ) { | ||
this.props.onFocusOutside( event ); | ||
} | ||
|
||
render() { | ||
return this.props.children; | ||
} | ||
} | ||
|
||
export default clickOutside( PopoverDetectOutside ); | ||
export default withFocusOutside( PopoverDetectOutside ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters