Skip to content

Commit

Permalink
Components: Stop using react-click-outside as a depenency (#16878)
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Aug 29, 2019
1 parent 9f32f13 commit 844a47c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
16 changes: 0 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- The `Dropdown` component has been refactored to focus changes using the `Popover` component's `onFocusOutside` prop.
- The `MenuItem` component will now always use an `IconButton`. This prevents a focus loss when clicking a menu item.
- Package no longer depends on external `react-click-outside` library.

## 8.0.0 (2019-06-12)

Expand Down
1 change: 0 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"moment": "^2.22.1",
"mousetrap": "^1.6.2",
"re-resizable": "^5.0.1",
"react-click-outside": "^3.0.0",
"react-dates": "^17.1.1",
"react-spring": "^8.0.20",
"rememo": "^3.0.0",
Expand Down
12 changes: 4 additions & 8 deletions packages/components/src/modal/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ import { ESCAPE } from '@wordpress/keycodes';
import { focus } from '@wordpress/dom';
import { withGlobalEvents, compose } from '@wordpress/compose';

/**
* External dependencies
*/
import clickOutside from 'react-click-outside';

/**
* Internal dependencies
*/
import withFocusOutside from '../higher-order/with-focus-outside';
import withFocusReturn from '../higher-order/with-focus-return';
import withConstrainedTabbing from '../higher-order/with-constrained-tabbing';

Expand All @@ -23,7 +19,7 @@ class ModalFrame extends Component {

this.containerRef = createRef();
this.handleKeyDown = this.handleKeyDown.bind( this );
this.handleClickOutside = this.handleClickOutside.bind( this );
this.handleFocusOutside = this.handleFocusOutside.bind( this );
this.focusFirstTabbable = this.focusFirstTabbable.bind( this );
}

Expand Down Expand Up @@ -52,7 +48,7 @@ class ModalFrame extends Component {
*
* @param {Object} event Mouse click event.
*/
handleClickOutside( event ) {
handleFocusOutside( event ) {
if ( this.props.shouldCloseOnClickOutside ) {
this.onRequestClose( event );
}
Expand Down Expand Up @@ -133,7 +129,7 @@ class ModalFrame extends Component {
export default compose( [
withFocusReturn,
withConstrainedTabbing,
clickOutside,
withFocusOutside,
withGlobalEvents( {
keydown: 'handleKeyDown',
} ),
Expand Down

0 comments on commit 844a47c

Please sign in to comment.