Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: Stop using react-click-outside as a dependency #16878

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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