-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 replacement to Popover onClickOutside (#…
…14851) * Components: Add onFocusOutside alternative to Popover onClickOutside * Components: Refactor Dropdown to use onFocusOutside * Format Library: Refactor inline link to use onFocusOutside * MenuItem: Always use an IconButton component so as to avoid focus loss. Switching between `Button` and `IconButton` causes React to remount the `MenuItem` component. This causes a focus loss as well as E2E failures. There's no need to use a `Button` for `MenuItems` that are unselected, since we can simply pass `icon={ undefined }` to the `IconButton`.
- Loading branch information
1 parent
9169895
commit 5b01c97
Showing
13 changed files
with
127 additions
and
74 deletions.
There are no files selected for viewing
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
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
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
Oops, something went wrong.