From 3c5c131f34bc4cd48ee993dd0d75a3909a3fba20 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Mon, 5 Sep 2022 13:00:42 +0300 Subject: [PATCH] Lodash: Refactor away from useFocusFirstElement --- .../block-list/use-block-props/use-focus-first-element.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js b/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js index 492555935dadf..03983726083f1 100644 --- a/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js +++ b/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { first, last } from 'lodash'; - /** * WordPress dependencies */ @@ -98,7 +93,7 @@ export function useFocusFirstElement( clientId ) { // tabbables. const isReverse = -1 === initialPosition; const target = - ( isReverse ? last : first )( textInputs ) || ref.current; + textInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current; if ( ! isInsideRootBlock( ref.current, target ) ) { ref.current.focus();