diff --git a/.yarn/cache/lodash.findlast-npm-4.6.0-1e52a8cabb-ee7c3e6287.zip b/.yarn/cache/lodash.findlast-npm-4.6.0-1e52a8cabb-ee7c3e6287.zip deleted file mode 100644 index e232b661ad71..000000000000 Binary files a/.yarn/cache/lodash.findlast-npm-4.6.0-1e52a8cabb-ee7c3e6287.zip and /dev/null differ diff --git a/packages/react/package.json b/packages/react/package.json index 96c9d9281911..1347405a79e3 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -61,7 +61,6 @@ "flatpickr": "4.6.13", "invariant": "^2.2.3", "lodash.debounce": "^4.0.8", - "lodash.findlast": "^4.5.0", "lodash.omit": "^4.5.0", "lodash.throttle": "^4.1.1", "prop-types": "^15.7.2", diff --git a/packages/react/src/internal/wrapFocus.js b/packages/react/src/internal/wrapFocus.js index 542554123ccf..2aa8100ecffc 100644 --- a/packages/react/src/internal/wrapFocus.js +++ b/packages/react/src/internal/wrapFocus.js @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import findLast from 'lodash.findlast'; import { useEffect } from 'react'; import { DOCUMENT_POSITION_BROAD_PRECEDING, @@ -62,10 +61,9 @@ function wrapFocus({ currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING ) { - const tabbable = findLast( - bodyNode.querySelectorAll(selectorTabbable), - (elem) => Boolean(elem.offsetParent) - ); + const tabbable = [...bodyNode.querySelectorAll(selectorTabbable)] + .reverse() + .find((elem) => Boolean(elem.offsetParent)); if (tabbable) { tabbable.focus(); } else if (bodyNode !== oldActiveNode) { diff --git a/yarn.lock b/yarn.lock index f2eeba906473..33548c9ee114 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2031,7 +2031,6 @@ __metadata: html-webpack-plugin: "npm:^5.5.0" invariant: "npm:^2.2.3" lodash.debounce: "npm:^4.0.8" - lodash.findlast: "npm:^4.5.0" lodash.omit: "npm:^4.5.0" lodash.throttle: "npm:^4.1.1" mini-css-extract-plugin: "npm:^2.4.5" @@ -18617,13 +18616,6 @@ __metadata: languageName: node linkType: hard -"lodash.findlast@npm:^4.5.0": - version: 4.6.0 - resolution: "lodash.findlast@npm:4.6.0" - checksum: 10/ee7c3e6287ebab628b06449c8847aa00263f10b43bc67f1245e4b34c2edd80802148299f61e8577675790a05a4abe75ffdadacd0984a93724a69c7a01873fb1d - languageName: node - linkType: hard - "lodash.flatten@npm:^4.4.0": version: 4.4.0 resolution: "lodash.flatten@npm:4.4.0"