Skip to content

Commit

Permalink
Components: Use ally.js for first tabbable selection
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Aug 14, 2017
1 parent c792cca commit 5ce8b15
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 264 deletions.
9 changes: 5 additions & 4 deletions components/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/
import classnames from 'classnames';
import { isEqual, noop } from 'lodash';
import queryFirstTabbable from 'ally.js/esm/query/first-tabbable';

/**
* WordPress dependencies
*/
import { createPortal, Component } from '@wordpress/element';
import { focus } from '@wordpress/utils';

/**
* Internal dependencies
Expand Down Expand Up @@ -87,9 +87,10 @@ export class Popover extends Component {
}

focus() {
const firstFocusable = focus.findFocusable( this.nodes.content );
if ( firstFocusable ) {
firstFocusable.focus();
const context = this.nodes.content;
const firstTabbable = queryFirstTabbable( { context } );
if ( firstTabbable ) {
firstTabbable.focus();
}
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"dependencies": {
"@wordpress/url": "0.1.0-beta.1",
"ally.js": "^1.4.1",
"classnames": "^2.2.5",
"clipboard": "^1.7.1",
"dom-react": "^2.2.0",
Expand Down
96 changes: 0 additions & 96 deletions utils/focus.js

This file was deleted.

2 changes: 0 additions & 2 deletions utils/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as focus from './focus';
import * as keycodes from './keycodes';
import * as nodetypes from './nodetypes';

export { focus };
export { keycodes };
export { nodetypes };

Expand Down
162 changes: 0 additions & 162 deletions utils/test/focus.js

This file was deleted.

0 comments on commit 5ce8b15

Please sign in to comment.