Skip to content

Commit

Permalink
Lodash: Refactor useArrowNav() away from _.reverse() and `_.find(…
Browse files Browse the repository at this point in the history
…)` (#41632)

* Lodash: Refactor away from _.reverse()

* Lodash: Refactor away from _.find()
  • Loading branch information
tyxla authored Jun 10, 2022
1 parent 27f3136 commit dbe195a
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import { find, reverse } from 'lodash';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -89,7 +84,7 @@ export function getClosestTabbable(
let focusableNodes = focus.focusable.find( containerElement );

if ( isReverse ) {
focusableNodes = reverse( focusableNodes );
focusableNodes.reverse();
}

// Consider as candidates those focusables after the current target. It's
Expand Down Expand Up @@ -130,7 +125,7 @@ export function getClosestTabbable(
return true;
}

return find( focusableNodes, isTabCandidate );
return focusableNodes.find( isTabCandidate );
}

export default function useArrowNav() {
Expand Down

0 comments on commit dbe195a

Please sign in to comment.